public function find($id)
    {
        // Retrieve identifier & id
        if (is_array($id)) {
            $keys       = array_keys($id);
            $identifier = $keys[0];
            $id         = $id[$identifier];
        } else {
            $identifier = $this->_em->getMetadataFactory()->getMetadataFor(ltrim($this->_entityName, '\\'))->identifier[0];
        }

        return $this->createQueryBuilder('a')
                    ->leftJoin('a.metas', 'm')->addSelect('m')
                    ->leftJoin('m.meta', 'meta')->addSelect('meta')
                    ->leftJoin('a.menus', 'me')->addSelect('me')
                    ->leftJoin('a.contents', 'co')->addSelect('co')
                    ->leftJoin('co.area', 'ar')->addSelect('ar')
                    ->leftJoin('a.template', 't')->addSelect('t')
                    ->where(sprintf('a.%s = :id', $identifier))->setParameter('id', $id)
                    ->getQuery()->getOneOrNullResult();
    }
public function find($id)
    {
        // Retrieve identifier & id
        if (is_array($id)) {
            $keys       = array_keys($id);
            $identifier = $keys[0];
            $id         = $id[$identifier];
        } else {
            $identifier = $this->_em->getMetadataFactory()->getMetadataFor(ltrim($this->_entityName, '\\'))->identifier[0];
        }

        return $this->createQueryBuilder('a')
                    ->leftJoin('a.metas', 'm')->addSelect('m')
                    ->leftJoin('m.meta', 'meta')->addSelect('meta')
                    ->leftJoin('a.menus', 'me')->addSelect('me')
                    ->leftJoin('a.contents', 'co')->addSelect('co')
                    ->leftJoin('co.area', 'ar')->addSelect('ar')
                    ->leftJoin('a.template', 't')->addSelect('t')
                    ->where(sprintf('a.%s = :id', $identifier))->setParameter('id', $id)
                    ->getQuery()->getOneOrNullResult();
    }
public function find ( $ id ) { // Retrieve identifier & id if ( is_array ( $ id ) ) { $ keys = array_keys ( $ id ) ; $ identifier = $ keys [ 0 ] ; $ id = $ id [ $ identifier ] ; } else { $ identifier = $ this -> _em -> getMetadataFactory ( ) -> getMetadataFor ( ltrim ( $ this -> _entityName , '\\' ) ) -> identifier [ 0 ] ; } return $ this -> createQueryBuilder ( 'a' ) -> leftJoin ( 'a.metas' , 'm' ) -> addSelect ( 'm' ) -> leftJoin ( 'm.meta' , 'meta' ) -> addSelect ( 'meta' ) -> leftJoin ( 'a.menus' , 'me' ) -> addSelect ( 'me' ) -> leftJoin ( 'a.contents' , 'co' ) -> addSelect ( 'co' ) -> leftJoin ( 'co.area' , 'ar' ) -> addSelect ( 'ar' ) -> leftJoin ( 'a.template' , 't' ) -> addSelect ( 't' ) -> where ( sprintf ( 'a.%s = :id' , $ identifier ) ) -> setParameter ( 'id' , $ id ) -> getQuery ( ) -> getOneOrNullResult ( ) ; }
Find an Article from its identifier

@author Vincent Chalamon <vincentchalamon@gmail.com>

@param integer $id Article identifier

@return Article
Find an Article from its identifier