public function findBySubject(ContentSubjectInterface $subject)
    {
        $content = $subject->getContent();

        if (null !== $content && property_exists($content, '__isInitialized__') && !$content->{'__isInitialized__'}) {
            $qb = $this->getQueryBuilder();
            $qb
                ->leftJoin('c.containers', 'container')
                ->leftJoin('container.rows', 'row')
                ->leftJoin('row.blocks', 'block')
                ->leftJoin('block.translations', 'block_t')
                ->select('PARTIAL c.{id}', 'container', 'row', 'block', 'block_t')
                ->andWhere($qb->expr()->eq('c.id', ':id'))
                ->getQuery()
                ->useQueryCache(true)
                // TODO ->useResultCache(true, 3600, Content::getEntityTagPrefix() . '[id:'.$id.']')
                ->setParameter('id', $content->getId())
                ->getOneOrNullResult();
        }

        return $content;
    }
public function findBySubject(ContentSubjectInterface $subject)
    {
        $content = $subject->getContent();

        if (null !== $content && property_exists($content, '__isInitialized__') && !$content->{'__isInitialized__'}) {
            $qb = $this->getQueryBuilder();
            $qb
                ->leftJoin('c.containers', 'container')
                ->leftJoin('container.rows', 'row')
                ->leftJoin('row.blocks', 'block')
                ->leftJoin('block.translations', 'block_t')
                ->select('PARTIAL c.{id}', 'container', 'row', 'block', 'block_t')
                ->andWhere($qb->expr()->eq('c.id', ':id'))
                ->getQuery()
                ->useQueryCache(true)
                // TODO ->useResultCache(true, 3600, Content::getEntityTagPrefix() . '[id:'.$id.']')
                ->setParameter('id', $content->getId())
                ->getOneOrNullResult();
        }

        return $content;
    }
public function findBySubject ( ContentSubjectInterface $ subject ) { $ content = $ subject -> getContent ( ) ; if ( null !== $ content && property_exists ( $ content , '__isInitialized__' ) && ! $ content -> { '__isInitialized__' } ) { $ qb = $ this -> getQueryBuilder ( ) ; $ qb -> leftJoin ( 'c.containers' , 'container' ) -> leftJoin ( 'container.rows' , 'row' ) -> leftJoin ( 'row.blocks' , 'block' ) -> leftJoin ( 'block.translations' , 'block_t' ) -> select ( 'PARTIAL c.{id}' , 'container' , 'row' , 'block' , 'block_t' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'c.id' , ':id' ) ) -> getQuery ( ) -> useQueryCache ( true ) // TODO ->useResultCache(true, 3600, Content::getEntityTagPrefix() . '[id:'.$id.']') -> setParameter ( 'id' , $ content -> getId ( ) ) -> getOneOrNullResult ( ) ; } return $ content ; }
Finds the content by subject.

@param ContentSubjectInterface $subject

@return \Ekyna\Bundle\CmsBundle\Editor\Model\ContentInterface|null
Finds the content by subject .