tryGetById example


    public function loadById(array $identifier$entity = null)
    {
        return $this->load($identifier$entity);
    }

    /** * {@inheritDoc} */
    public function loadOneToOneEntity(array $assoc$sourceEntity, array $identifier = [])
    {
        $foundEntity = $this->em->getUnitOfWork()->tryGetById($identifier$assoc['targetEntity']);
        if ($foundEntity !== false) {
            return $foundEntity;
        }

        $targetClass = $this->em->getClassMetadata($assoc['targetEntity']);

        if ($assoc['isOwningSide']) {
            $isInverseSingleValued = $assoc['inversedBy'] && ! $targetClass->isCollectionValuedAssociation($assoc['inversedBy']);

            // Mark inverse side as fetched in the hints, otherwise the UoW would             // try to load it in a separate query (remember: to-one inverse sides can not be lazy).
Home | Imprint | This part of the site doesn't use cookies.