예제 #1
0
 /**
  * Checks whether the given object is contained in the array. This checks
  * for object identity in terms of the persistence layer, i.e. the UUID,
  * when comparing entities.
  *
  * @param array $array
  * @param object $object
  * @param string $identifier
  * @return boolean
  */
 protected function arrayContainsObject(array $array, $object, $identifier)
 {
     if (in_array($object, $array, TRUE) === TRUE) {
         return TRUE;
     }
     foreach ($array as $value) {
         if ($value instanceof $object && $this->persistenceSession->getIdentifierByObject($value) === $identifier) {
             return TRUE;
         }
     }
     return FALSE;
 }
예제 #2
0
 /**
  * Returns the (internal) identifier for the object, if it is known to the
  * backend. Otherwise NULL is returned.
  *
  * Note: this returns an identifier even if the object has not been
  * persisted in case of AOP-managed entities. Use isNewObject() if you need
  * to distinguish those cases.
  *
  * @param object $object
  * @return mixed The identifier for the object if it is known, or NULL
  * @api
  */
 public function getIdentifierByObject($object)
 {
     return $this->persistenceSession->getIdentifierByObject($object);
 }