2

I have a class that extends Zend_Db_Table lets call it 'Users' that uses the class 'User' (inheriting from Zend_Db_Table_Row_Abstract) as its rowClass. I need it this way because User has additional methods that I use.

As far as I know it is not possible to join tables inside my Users class so I use:

$query = $db->select(); $query->from(...); $query->joinInner(...);

instead of

$this->select(); ...

But then of course the rows I get are not of the User class. So I would like to know how can I force my query to return User objects instead of Row objects.

Another way would be to get Zend_Db_Table to make that join in which case I would also get what I want.

Omar Kohl
  • 1,372
  • 2
  • 15
  • 32
  • possible duplicate of [How to use Join in Zend Framework.](http://stackoverflow.com/questions/2311481/how-to-use-join-in-zend-framework) and a couple others. – Gordon Jul 15 '10 at 12:30
  • Once you see that answer and know something about Zend you can see the questions are very related but I still think keeping this questions has value because the keywords my questions contains was what I searched for and couldn't find so maybe someone else has the same problem... – Omar Kohl Jul 15 '10 at 20:11

1 Answers1

3

Quoting David Caunt's answer in linked duplicate:

Because Zend_Db_Table provides row gateway functions, which don't work if you join on other tables, you have to state that you are willing to give it up. Simply make a call to setIntegrityCheck and it will work:

$select->setIntegrityCheck(false);

Community
  • 1
  • 1
Gordon
  • 312,688
  • 75
  • 539
  • 559