Bundle/BusinessEntityBundle/Helper/BusinessEntityHelper.php
protected function findEntityByBusinessEntityAndAttribute(BusinessEntity $businessEntity, $attributeName, $attributeValue)
    {
        if (!$this->entityManager) {
            throw new \Exception('EntityManager not defined, you should use the "victoire_core.helper.queriable_business_entity_helper" service');
        }
        //retrieve the class of the business entity
        $class = $businessEntity->getClass();

        //get the repository
        $repo = $this->entityManager->getRepository($class);

        $functionName = 'findOneBy'.ucfirst($attributeName);

        //get the entity
        $entity = call_user_func([$repo, $functionName], $attributeValue);

        return $entity;
    }
protected function findEntityByBusinessEntityAndAttribute(BusinessEntity $businessEntity, $attributeName, $attributeValue)
    {
        if (!$this->entityManager) {
            throw new \Exception('EntityManager not defined, you should use the "victoire_core.helper.queriable_business_entity_helper" service');
        }
        //retrieve the class of the business entity
        $class = $businessEntity->getClass();

        //get the repository
        $repo = $this->entityManager->getRepository($class);

        $functionName = 'findOneBy'.ucfirst($attributeName);

        //get the entity
        $entity = call_user_func([$repo, $functionName], $attributeValue);

        return $entity;
    }
protected function findEntityByBusinessEntityAndAttribute ( BusinessEntity $ businessEntity , $ attributeName , $ attributeValue ) { if ( ! $ this -> entityManager ) { throw new \ Exception ( 'EntityManager not defined, you should use the "victoire_core.helper.queriable_business_entity_helper" service' ) ; } //retrieve the class of the business entity $ class = $ businessEntity -> getClass ( ) ; //get the repository $ repo = $ this -> entityManager -> getRepository ( $ class ) ; $ functionName = 'findOneBy' . ucfirst ( $ attributeName ) ; //get the entity $ entity = call_user_func ( [ $ repo , $ functionName ] , $ attributeValue ) ; return $ entity ; }
Find a entity by the business entity and the attributeValue.
Must be called by the service victoire_core.helper.queriable_business_entity_helper.

@param BusinessEntity $businessEntity
@param string         $attributeName
@param string         $attributeValue

@return Entity
Find a entity by the business entity and the attributeValue . Must be called by the service victoire_core . helper . queriable_business_entity_helper .