Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1638 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Models in Zend

Thread title: Models in Zend
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
02-09-2011, 12:44 PM
#1
Hero is offline Hero
Hero's Avatar
Status: Very much the flyest.
Join date: Mar 2006
Location: Belgium
Expertise:
Software:
 
Posts: 1,171
iTrader: 1 / 100%
 

Hero is on a distinguished road

  Old  Models in Zend

Hey guys,

I'm working on a website in Zend, and so far I'm not really liking this framework. There's several things that bug me, when I compare it with CI, and their documentation isn't half as good.


One of the problems for me, are the models. Zend says you're supposed to implement those yourself, and that you're free in how to do this.

What I've done so far, is extend my models with Zend_Db_Table_Abstract. And my models are named after my database tables (Model_Table_User for users, Model_Table_Post for posts..)

Problem is that there are limitations to the Zend_Db_Table. For example, it isn't possible to use sql joins, because then you would end up selecting columns that don't exist in a specific table. So I end up doing my join selects like this:

Code:
	$db = Zend_Registry::get('db');
	$query = "SELECT tag_name FROM tags t JOIN posts_tags pt ON pt.tag_id = t.tag_id where pt.post_id = ?";
	$results = $db->query($query, array($postid));
	$tags = $results->fetchAll();
This works, but my problem is, that this is coming from my Controller. It defeats the whole purpose of the M in MVC if I'm addressing my database from the Controller.

Any suggestions how to go about this?

     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed