trunk: PersistentObject and relations

Author Message

G E

Thursday 23 November 2006 11:03:44 pm

Sorry for my english.
From documentation. An array ezcPersistentObjectDefinition::relations indexed by _class names_ of the related objects. Methods ezcPersistentSession::getRelatedObject( $object, $relatedClass ) and ezcPersistentSession::getRelatedObjects( $object, $relatedClass ) lookup related object by _class names_. What's about domain object has several properties with same class? For example (pseudo code):

class Person 
{
   int id;
   Person mother;
   Person father;
}

Generally, class name is not unique key for object relations (int, Person, Person). Unique key for it, is object property names (id, mother, father). Furthermore, loading related object by property name can to be straightly: ezcPersistentSession::getRelatedObjects( $object, $propertyName )

$mother = ezcPersistentSession::getRelatedObjects( $person, 'mother' ); // $person->mother;

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.