Hi Tobias,

Ok, thats not good if this is the only way because if i have 5 related
tables i need to loop through all these 5 tables and merge the results
to one array.

If there is no possibility with ezc to fetch all attributes at once, it
should at least possible to store the manually fetched result within the
persistent session?!

Something like:
$ezcSession->setDataManually($result);


greetings René

Tobias Schlitt schrieb:
> Hi Christoph,
> 
> On 04/24/2010 11:08 AM, Christoph René Pardon wrote:
> 
>> no, i only use one of both methods. Both together make no sense.
>>
>> If i try $ezcSession->findWithRelations($query) the following exception
>> is thrown:
>>
>> Fatal error: Call to private method
>> ezcPersistentSessionIdentityDecorator::findWithRelations() from context
>> 'Admin_Service_User' in
>> /var/www/YelaCMS/public/YelaCMS/components/admin/services/User.php on
>> line 111
>>
>> Where $result = $ezcSession->findWithRelations($query) is on line 111.
> 
> a, right. Didn't have the API fully in my mind anymore. Looking it up,
> this is logical.
> 
> $ezcSession->find( $query );
> 
> is the way to go.
> 
>> You can see in the following example, that only the columns/attributes
>> from table one were fetched. But i need ALL attributes from ALL related
>> tables.
> 
> Ah, now I get your problem. Well, this is not the way it is meant to be
> used.
> 
> The find() method only returns the root objects you intended to fetch.
> To access the related objects you need to call
> 
> $ezcSession->getRelatedObjects( $rootObject, 'ClassOfRelatedObject' );
> 
> This will then return the desired objects from the cache.
> 
> In your case that would be something like:
> 
> $users = $ezcSession->find( $query );
> 
> foreach ( $users as $user )
> {
>     $infos = $ezcSession->getRelatedObjects(
>         $user,
>         'Yela_Persistence_Users_Informations'
>     );
>     // ...
> }
> 
> The desired objects are fetched by the find() call, but not returned.
> Calling getRelatedObjects() returns them from the internal object cache
> in the session.
> 
> HTH, cheers,
> Toby
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to