public function getIdentifierByObject($object)
    {
        if ($this->hasObject($object)) {
            return $this->objectMap[$object];
        }

        $idPropertyNames = $this->reflectionService->getPropertyNamesByTag(get_class($object), 'id');
        if (count($idPropertyNames) === 1) {
            $idPropertyName = $idPropertyNames[0];
            return ObjectAccess::getProperty($object, $idPropertyName, true);
        } elseif (property_exists($object, 'Persistence_Object_Identifier')) {
            return ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true);
        }

        return null;
    }
public function getIdentifierByObject($object)
    {
        if ($this->hasObject($object)) {
            return $this->objectMap[$object];
        }

        $idPropertyNames = $this->reflectionService->getPropertyNamesByTag(get_class($object), 'id');
        if (count($idPropertyNames) === 1) {
            $idPropertyName = $idPropertyNames[0];
            return ObjectAccess::getProperty($object, $idPropertyName, true);
        } elseif (property_exists($object, 'Persistence_Object_Identifier')) {
            return ObjectAccess::getProperty($object, 'Persistence_Object_Identifier', true);
        }

        return null;
    }
public function getIdentifierByObject ( $ object ) { if ( $ this -> hasObject ( $ object ) ) { return $ this -> objectMap [ $ object ] ; } $ idPropertyNames = $ this -> reflectionService -> getPropertyNamesByTag ( get_class ( $ object ) , 'id' ) ; if ( count ( $ idPropertyNames ) === 1 ) { $ idPropertyName = $ idPropertyNames [ 0 ] ; return ObjectAccess :: getProperty ( $ object , $ idPropertyName , true ) ; } elseif ( property_exists ( $ object , 'Persistence_Object_Identifier' ) ) { return ObjectAccess :: getProperty ( $ object , 'Persistence_Object_Identifier' , true ) ; } return null ; }
Returns the identifier for the given object either from
the session, if the object was registered, or from the object
itself using a special uuid property or the internal
properties set by AOP.

Note: this returns an UUID 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 string
@api
Returns the identifier for the given object either from the session if the object was registered or from the object itself using a special uuid property or the internal properties set by AOP .