Beispiel #1
0
 /**
  * Returns the persistent object of class $class with id $id.
  *
  * Checks if the object of $class with $id has already been loaded. If this
  * is the case, the existing identity is returned. Otherwise the desired
  * object is loaded from the database and its identity is recorded for
  * later uses.
  *
  * @throws ezcPersistentObjectException
  *         if the object is not available.
  * @throws ezcPersistentObjectException
  *         if there is no such persistent $class.
  *
  * @param string $class
  * @param mixed $id
  *
  * @return ezcPersistentObject
  */
 public function load($class, $id)
 {
     $idMap = $this->properties['identityMap'];
     if (!$this->properties['options']->refetch) {
         $identity = $idMap->getIdentity($class, $id);
         if ($identity !== null) {
             return $identity;
         }
     }
     $identity = $this->session->load($class, $id);
     $idMap->setIdentity($identity);
     return $identity;
 }