primary table columns, not joined tables. You're better off using the
> Thank you for the fast answer.
> No Exception anymore, but how can I access to the values?
> If I dump the $rowset I get:
> [6] => array(4) {
> ["user_id"] => string(1) "9"
> ["user_name"] => string(6) "sascha"
> ["user_password"] => string(7) "foopass"
> ["user_email"] => string(13) "
[hidden email]"
>
> No Joined Data :(
>
> Best regards
>
> -------- Original-Nachricht --------
>> Datum: Fri, 2 Nov 2007 23:46:10 +1100
>> Von: Simon Mundy <
[hidden email]>
>> An:
[hidden email]
>> CC:
[hidden email]
>> Betreff: Re: revised Zend Db Table and JOINs
>
>> Yep, it's the join() method being overly-helpful - if you don't
>> specify an empty array then it assumes '*' (or all fields).
>>
>> Try:-
>>
>> $select->join('phones', 'phones.user_id = users.user_id', array())
>> ->group('user_id');
>>
>>> Hi Simon,
>>>
>>> after I already posted in the nabble.com forum and thread isn't any
>>> more visible and lost, I will ask you directlty. When I try to fetch
>>> something with a JOIN, I get an exception:
>>>
>>> exception 'Zend_Db_Table_Exception' with message 'Select query
>>> cannot join with another table'
>>> Don't know why, I tried your code on nabble.
>>>
>>> ---- Users.php -------
>>> class Users extends Zend_Db_Table_Abstract {
>>> protected $_primary = 'user_id';
>>> protected $_name = 'users';
>>>
>>> protected $_dependentTables = array('Phones');
>>>
>>> }
>>>
>>> ----- Phones.php -----
>>> class Phones extends Zend_Db_Table_Abstract {
>>> protected $_primary = 'phone_id';
>>> protected $_name = 'phones';
>>>
>>> protected $_referenceMap = array(
>>> 'Users' => array(
>>> 'columns' => 'user_id',
>>> 'refTableClass' => 'Users',
>>> 'refColumns' => 'user_id'
>>> )
>>> );
>>> }
>>>
>>> ----- IndexController.php -------
>>> $this->_helper->modelLoader('Users');
>>> $this->_helper->modelLoader('Phones');
>>> $userTable = new Users();
>>>
>>> $select = $userTable->select();
>>> $select->join('phones', 'phones.user_id = users.user_id')
>>> ->group('user_id');
>>>
>>> $partial = $userTable->fetchAll($select);
>>> Zend_Debug::dump($partial);
>>>
>>> Any Ideas?
>>>
>>> Best regards!
>>>
>>
>>
>>
>> --
>>
>> Simon Mundy | Director | PEPTOLAB
>>
>> """ " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
>> 202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
>> Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
>> 4124
>>
http://www.peptolab.com>>
>
> --
> GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
> Alle Infos und kostenlose Anmeldung:
http://www.gmx.net/de/go/freemail