src/MamuzBlog/Controller/PostQueryController.php
public function publishedPostAction()
    {
        $encryptedId = $this->params()->fromRoute('id');
        if ($decryptedId = $this->cryptEngine->decrypt($encryptedId)) {
            $post = $this->queryService->findPublishedPostById($decryptedId);
        }

        if (!isset($post)) {
            return $this->nullResponse();
        }

        /** @var ServiceLocatorInterface $viewHelperManager */
        $viewHelperManager = $this->getServiceLocator()->get('ViewHelperManager');
        /** @var callable $slugifier */
        $slugifier = $viewHelperManager->get('slugify');
        /** @var callable $permaLink */
        $permaLink = $viewHelperManager->get('permaLinkPost');

        if ($slugifier($post->getTitle()) !== $this->params()->fromRoute('title')) {
            return $this->redirect()->toUrl($permaLink($post));
        }

        return $this->viewModelFactory()->create(array('post' => $post));
    }
public function publishedPostAction()
    {
        $encryptedId = $this->params()->fromRoute('id');
        if ($decryptedId = $this->cryptEngine->decrypt($encryptedId)) {
            $post = $this->queryService->findPublishedPostById($decryptedId);
        }

        if (!isset($post)) {
            return $this->nullResponse();
        }

        /** @var ServiceLocatorInterface $viewHelperManager */
        $viewHelperManager = $this->getServiceLocator()->get('ViewHelperManager');
        /** @var callable $slugifier */
        $slugifier = $viewHelperManager->get('slugify');
        /** @var callable $permaLink */
        $permaLink = $viewHelperManager->get('permaLinkPost');

        if ($slugifier($post->getTitle()) !== $this->params()->fromRoute('title')) {
            return $this->redirect()->toUrl($permaLink($post));
        }

        return $this->viewModelFactory()->create(array('post' => $post));
    }
public function publishedPostAction ( ) { $ encryptedId = $ this -> params ( ) -> fromRoute ( 'id' ) ; if ( $ decryptedId = $ this -> cryptEngine -> decrypt ( $ encryptedId ) ) { $ post = $ this -> queryService -> findPublishedPostById ( $ decryptedId ) ; } if ( ! isset ( $ post ) ) { return $ this -> nullResponse ( ) ; } /** @var ServiceLocatorInterface $viewHelperManager */ $ viewHelperManager = $ this -> getServiceLocator ( ) -> get ( 'ViewHelperManager' ) ; /** @var callable $slugifier */ $ slugifier = $ viewHelperManager -> get ( 'slugify' ) ; /** @var callable $permaLink */ $ permaLink = $ viewHelperManager -> get ( 'permaLinkPost' ) ; if ( $ slugifier ( $ post -> getTitle ( ) ) !== $ this -> params ( ) -> fromRoute ( 'title' ) ) { return $ this -> redirect ( ) -> toUrl ( $ permaLink ( $ post ) ) ; } return $ this -> viewModelFactory ( ) -> create ( array ( 'post' => $ post ) ) ; }
Published post entry retrieval

@return ModelInterface|null|\Zend\Http\Response
Published post entry retrieval