I've implemented the get<Related> method on rows AND "row sets" (actually a
subclass of rowset). So you can get the related objects in 2 queries
$puppies = $do->findAllPuppies();
// $puppies is a row_set
$puppiesFleas = $puppies->getAllFleas();
Sylvain
Synaptic Media wrote:
>
> Sylvain,
>
> I have this, but its called on the record object, so:
>
> $dog = $do->find();
> $fleas = $dog->getAllFleas();
>
> But if you have 300 dogs it's 1+{Numer of Rows) the queries. If
> however when you do something like:
>
> $dogs = $do->fetchAll();
>
> it automatically did a JOIN there, it's one query.
>
> - Davey
>
> On Sep 22, 2006, at 11:21 AM, sylvain bannier wrote:
>
>>
>> I actually have implemented a feature that enables related objects
>> fetch
>> based on columns name.
>>
>> providing your table has a field named "fk_myRelatedTable" or
>> something like
>> that, you can get related objects by usings methods like this :
>>
>> $relatedObject = $myParentObject->getMyRelatedObject();
>>
>> This method automatically performs the "joins".
>>
>>
>>
>>
>>
>>
>> Synaptic Media wrote:
>>>
>>> I actually have a fully working Rails-like (not /too/ similar though)
>>> ActiveRecord implementation that got lost (bureaucratically)
>>> somewhere in the mix.
>>>
>>> The only feature I would like to add is the possibility to resolve
>>> relationships automatically, such that it can condense the number of
>>> queries down using JOINs.
>>>
>>> - Davey
>>>
>>> On Sep 22, 2006, at 10:04 AM, sylvain bannier wrote:
>>>
>>>>
>>>>
>>>>
>>>> Rodrigo Moraes wrote:
>>>>>
>>>>> On 7/11/06, Fabien MARTY wrote:
>>>>>> - First, we need to introduce two protected properties in
>>>>>> Table.php file
>>>>>> protected $_rowClassName = 'Zend_Db_Table_Row';
>>>>>> protected $_rowsetClassName = 'Zend_Db_Table_Rowset';
>>>>>
>>>>> I think this makes a lot of sense and adds a lot of flexibility to
>>>>> Zend_Db_Table. We can make our own base class subclassing
>>>>> Zend_Db_Table and changing fetchNew(), fetchRow() and fetchAll() to
>>>>> implement this idea, but I think it would be worth to have this in
>>>>> Zend_Db_Table itself, unless there are other plans for these
>>>>> methods...
>>>>>
>>>>> cheers,
>>>>> rodrigo moraes / brazil
>>>>>
>>>>>
>>>>
>>>> Hello,
>>>> I made a few steps in this way. if you're interested, i could send
>>>> you my
>>>> files.
>>>> regards,
>>>> --
>>>> View this message in context: http://www.nabble.com/-need-advices--
>>>> An-idea-to-build-a-KISS-ORM-system-upon-Zend_Db_Table-
>>>> tf1926214.html#a6447689
>>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/-need-advices--
>> An-idea-to-build-a-KISS-ORM-system-upon-Zend_Db_Table-
>> tf1926214.html#a6449160
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>
>
>
--
View this message in context:
http://www.nabble.com/-need-advices--An-idea-to-build-a-KISS-ORM-system-upon-Zend_Db_Table-tf1926214.html#a6452241
Sent from the Zend Framework mailing list archive at Nabble.com.