object($relatedClass)) * * @throws ezcPersistentIdentityRelatedObjectsInconsistentException * if an object in $relatedObjects is not of $relatedClass. * */ public function setRelatedObjects( $sourceObject, array $relatedObjects, $relatedClass, $relationName = null, $replaceIdentities = false ); /** * Records a named set of $relatedObjects for $sourceObject. * * Records the given array of $relatedObjects with as a "named related * object sub-set" for $sourceObject, using $setName. A named "named * related object sub-set" contains only objects related to $sourceObject, * but not necessarily all such objects of a certain class. Such a set is * the result of {@link ezcPersistentSessionIdentityDecorator::find()} with * a find query generated by {@link * ezcPersistentSessionIdentityDecorator::createFindQueryWithRelations()} * and manipulated using a WHERE clause. * * In case a named set of related objects with $setName has already been * recorded for $sourceObject, this set is silently replaced. * * If for any of the objects in $relatedObjects no identity is recorded, * yet, it will be recorded. Otherwise, the object will be replaced by its * existing identity in the set. Except for if $replaceIdentities is set to * true: In this case a new identity will be recorded for every object in * $relatedObjects. * * The method returns the created set of related objects to avoid another * call to {@link getRelatedObjectSet()} by the using objct. * * @param ezcPersistentObject $sourceObject * @param array(ezcPersistentObject) $relatedObjects * @param string $setName * @param bool $replaceIdentities * * @return array(ezcPersistentObject) * * @throws ezcPersistentIdentityRelatedObjectsInconsistentException * if an object in $relatedObjects is not of $relatedClass. */ public function setRelatedObjectSet( $sourceObject, array $relatedObjects, $setName, $replaceIdentities = false ); /** * Appends a new $relatedObject to a related object set of $sourceObject. * * Appends the given $relatedObject to the set of related objects for * $sourceObject with the class of $relatedObject and optionally * $relationName. * * In case that no set of related objects with the specific class has been * recorded for $object, yet, the call is ignored and related objects are * newly fetched whenever {@link getRelatedObjects()} is called. * * Note: All named related object sub-sets for $relatedObject are * automatically invalidated by a call to the method. The identity map can * not determine, to which named related object sub-set the $relatedObject * might be added. * * @param ezcPersistentObject $sourceObject * @param ezcPersistentObject $relatedObject * @param string $relationName * * @throws ezcPersistentRelationNotFoundException * if no relation from $sourceObject to $relatedObject is defined. * @throws ezcPersistentIdentityMissingException * if no identity has been recorded for $sourceObject or * $relatedObject, yet. * @throws ezcPersistentIdentityRelatedObjectAlreadyExistsException * if the given $relatedObject is already part of the set of * related objects it should be added to. */ public function addRelatedObject( $sourceObject, $relatedObject, $relationName = null ); /** * Removes a $relatedObject from the sets of related objects of $sourceObject. * * Removes the $relatedObject from all recorded sets of related objects * (named and unnamed) for $sourceObject. This method (in contrast to * {@link addRelatedObject()}) does not invalidate named related object * sets, but simply removes the $relatedObject from them. * * @param ezcPersistentObject $sourceObject * @param ezcPersistentObject $relatedObject * @param string $relationName * * @throws ezcPersistentIdentityMissingException * if no identity for $sourceObject has been recorded, yet. */ public function removeRelatedObject( $sourceObject, $relatedObject, $relationName = null ); /** * Returns the set of related objects of $relatedClass for $sourceObject. * * Returns the set of related objects of $relatedClass for $sourceObject. * This might also be an empty set (empty array). In case no related * objects are recorded, yet, null is returned. * * @param ezcPersistentObject $sourceObject * @param string $relatedClass * @param string $relationName * * @return array(object($relatedClass))|null * * @throws ezcPersistentRelationNotFoundException * if not relation between the class of $sourceObject and * $relatedClass (with optionally $relationName) is defined. */ public function getRelatedObjects( $sourceObject, $relatedClass, $relationName = null ); /** * Returns the named set of related objects for $sourceObject with $setName. * * Returns the named set of related objects for $sourceObject identified by * $setName. This might also be an empty set (empty array). In case no * related objects with this name are recorded, yet, null is returned. * * @param ezcPersistentObject $sourceObject * @param string $setName * @return array(object($relatedClass))|null */ public function getRelatedObjectSet( $sourceObject, $setName ); /** * Resets the complete identity map. * * Removes all stored identities from the map and resets it into its * initial state. */ public function reset(); } ?>