private function findRelatedPage($entity)
    {
        // By Translation
        if ($entity instanceof Cms\PageTranslationInterface) {
            return $entity->getTranslatable();
        }

        // By Seo
        if ($entity instanceof Cms\SeoTranslationInterface && null !== $entity->getId()) {
            return $this->manager
                ->createQuery("SELECT p FROM {$this->pageClass} p WHERE p.seo = :seo")
                ->setMaxResults(1)
                ->setParameter('seo', $entity->getTranslatable())
                ->getOneOrNullResult();
        }

        // By Content
        /** @var \Ekyna\Bundle\CmsBundle\Editor\Model\ContentInterface $content */
        $content = null;
//       TODO if ($entity instanceof Cms\BlockTranslationInterface) {
//            /** @var Cms\BlockInterface $block */
//            $block = $entity->getTranslatable();
//            $content = $block->getContent();
//        }
        if (null !== $content && null !== $content->getId()) {
            return $this->manager
                ->createQuery("SELECT p FROM {$this->pageClass} p WHERE p.content = :content")
                ->setMaxResults(1)
                ->setParameter('content', $content)
                ->getOneOrNullResult();
        }

        return null;
    }
private function findRelatedPage($entity)
    {
        // By Translation
        if ($entity instanceof Cms\PageTranslationInterface) {
            return $entity->getTranslatable();
        }

        // By Seo
        if ($entity instanceof Cms\SeoTranslationInterface && null !== $entity->getId()) {
            return $this->manager
                ->createQuery("SELECT p FROM {$this->pageClass} p WHERE p.seo = :seo")
                ->setMaxResults(1)
                ->setParameter('seo', $entity->getTranslatable())
                ->getOneOrNullResult();
        }

        // By Content
        /** @var \Ekyna\Bundle\CmsBundle\Editor\Model\ContentInterface $content */
        $content = null;
//       TODO if ($entity instanceof Cms\BlockTranslationInterface) {
//            /** @var Cms\BlockInterface $block */
//            $block = $entity->getTranslatable();
//            $content = $block->getContent();
//        }
        if (null !== $content && null !== $content->getId()) {
            return $this->manager
                ->createQuery("SELECT p FROM {$this->pageClass} p WHERE p.content = :content")
                ->setMaxResults(1)
                ->setParameter('content', $content)
                ->getOneOrNullResult();
        }

        return null;
    }
private function findRelatedPage ( $ entity ) { // By Translation if ( $ entity instanceof Cms \ PageTranslationInterface ) { return $ entity -> getTranslatable ( ) ; } // By Seo if ( $ entity instanceof Cms \ SeoTranslationInterface && null !== $ entity -> getId ( ) ) { return $ this -> manager -> createQuery ( "SELECT p FROM {$this->pageClass} p WHERE p.seo = :seo" ) -> setMaxResults ( 1 ) -> setParameter ( 'seo' , $ entity -> getTranslatable ( ) ) -> getOneOrNullResult ( ) ; } // By Content /** @var \Ekyna\Bundle\CmsBundle\Editor\Model\ContentInterface $content */ $ content = null ; //       TODO if ($entity instanceof Cms\BlockTranslationInterface) { //            /** @var Cms\BlockInterface $block */ //            $block = $entity->getTranslatable(); //            $content = $block->getContent(); //        } if ( null !== $ content && null !== $ content -> getId ( ) ) { return $ this -> manager -> createQuery ( "SELECT p FROM {$this->pageClass} p WHERE p.content = :content" ) -> setMaxResults ( 1 ) -> setParameter ( 'content' , $ content ) -> getOneOrNullResult ( ) ; } return null ; }
Finds the related page.

@param object $entity
@return Cms\PageInterface
Finds the related page .