Bundle/BusinessPageBundle/Repository/BusinessPageRepository.php
public function findPageByBusinessEntityAndPattern(BusinessTemplate $pattern, $entity, BusinessEntity $businessEntity)
    {
        if (is_object($entity)) {
            $entity = $entity->getId();
        }
        $qb = $this->createQueryBuilder('BusinessPage');
        $qb->join('BusinessPage.entityProxy', 'proxy');
        $qb->join('BusinessPage.template', 'template');
        $qb->join('proxy.'.$businessEntity->getId(), 'entity');

        $qb->where('template.id = :templateId');

        $qb->andWhere('entity.id = :entityId');

        $qb->setParameter(':templateId', $pattern);
        $qb->setParameter(':entityId', $entity);
        $result = $qb->getQuery()->getOneOrNullResult();

        return $result;
    }
public function findPageByBusinessEntityAndPattern(BusinessTemplate $pattern, $entity, BusinessEntity $businessEntity)
    {
        if (is_object($entity)) {
            $entity = $entity->getId();
        }
        $qb = $this->createQueryBuilder('BusinessPage');
        $qb->join('BusinessPage.entityProxy', 'proxy');
        $qb->join('BusinessPage.template', 'template');
        $qb->join('proxy.'.$businessEntity->getId(), 'entity');

        $qb->where('template.id = :templateId');

        $qb->andWhere('entity.id = :entityId');

        $qb->setParameter(':templateId', $pattern);
        $qb->setParameter(':entityId', $entity);
        $result = $qb->getQuery()->getOneOrNullResult();

        return $result;
    }
public function findPageByBusinessEntityAndPattern ( BusinessTemplate $ pattern , $ entity , BusinessEntity $ businessEntity ) { if ( is_object ( $ entity ) ) { $ entity = $ entity -> getId ( ) ; } $ qb = $ this -> createQueryBuilder ( 'BusinessPage' ) ; $ qb -> join ( 'BusinessPage.entityProxy' , 'proxy' ) ; $ qb -> join ( 'BusinessPage.template' , 'template' ) ; $ qb -> join ( 'proxy.' . $ businessEntity -> getId ( ) , 'entity' ) ; $ qb -> where ( 'template.id = :templateId' ) ; $ qb -> andWhere ( 'entity.id = :entityId' ) ; $ qb -> setParameter ( ':templateId' , $ pattern ) ; $ qb -> setParameter ( ':entityId' , $ entity ) ; $ result = $ qb -> getQuery ( ) -> getOneOrNullResult ( ) ; return $ result ; }
Find the pagePatterns of the business entity.

@param BusinessTemplate $pattern
@param object           $entity         | int $entityId
@param BusinessEntity   $businessEntity

@return mixed
Find the pagePatterns of the business entity .