Beispiel #1
0
 /**
  * Loads the persistent object of $class with $id into the given $object.
  *
  * The class of the persistent object to load is determined from $object.
  * In case an identity for the given $id has already been recorded in the
  * identity map and $object is not the same instance, an exception is
  * thrown.
  *
  * @throws ezcPersistentObjectException
  *         if the object is not available.
  * @throws ezcPersistentDefinitionNotFoundException
  *         if $object is not of a valid persistent object type.
  * @throws ezcPersistentQueryException
  *         if the find query failed.
  * @throws ezcPersistentIdentityAlreadyExistsException
  *         if a different identity of the class of $object with $id already
  *         exists.
  *
  * @param ezcPersistentObject $object
  * @param mixed $id
  */
 public function loadIntoObject($object, $id)
 {
     $idMap = $this->properties['identityMap'];
     $class = get_class($object);
     if (!$this->properties['options']->refetch) {
         $identity = $idMap->getIdentity($class, $id);
         if ($identity !== null) {
             throw new ezcPersistentIdentityAlreadyExistsException($class, $id);
         }
     }
     $this->session->loadIntoObject($object, $id);
     $idMap->setIdentity($object);
 }