public function getIdValue($object)
    {
        if (!$object) {
            return;
        }

        if (!$this->om->contains($object)) {
            throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', \get_class($object)));
        }

        $this->om->initializeObject($object);

        $idValue = current($this->classMetadata->getIdentifierValues($object));

        if ($this->associationIdReader) {
            $idValue = $this->associationIdReader->getIdValue($idValue);
        }

        return $idValue;
    }
public function getIdValue($object)
    {
        if (!$object) {
            return;
        }

        if (!$this->om->contains($object)) {
            throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', \get_class($object)));
        }

        $this->om->initializeObject($object);

        $idValue = current($this->classMetadata->getIdentifierValues($object));

        if ($this->associationIdReader) {
            $idValue = $this->associationIdReader->getIdValue($idValue);
        }

        return $idValue;
    }
public function getIdValue ( $ object ) { if ( ! $ object ) { return ; } if ( ! $ this -> om -> contains ( $ object ) ) { throw new RuntimeException ( sprintf ( 'Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?' , \ get_class ( $ object ) ) ) ; } $ this -> om -> initializeObject ( $ object ) ; $ idValue = current ( $ this -> classMetadata -> getIdentifierValues ( $ object ) ) ; if ( $ this -> associationIdReader ) { $ idValue = $ this -> associationIdReader -> getIdValue ( $ idValue ) ; } return $ idValue ; }
Returns the ID value for an object.

This method assumes that the object has a single-column ID.

@param object $object The object

@return mixed The ID value
Returns the ID value for an object .