Example #1
0
 /**
  * {@inheritdoc}
  */
 public function isPublic()
 {
     if ($parent = $this->parent) {
         return $parent->isPublic() && parent::isPublic();
     }
     return parent::isPublic();
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function __construct(WP $wp, Request $request)
 {
     parent::__construct($wp, $request);
     try {
         if ($id = $this->route('post__id')) {
             $this->post = $this->wp->post((int) $id, $this->postType);
         } elseif ($slug = $this->route('post__slug')) {
             $this->post = $this->wp->post($slug, $this->postType);
         } elseif ($path = $this->route('post__path')) {
             $this->post = $this->wp->post($path, $this->postType);
         } else {
             throw new NotFoundHttpException();
         }
         if (!$this->post->isPublic()) {
             throw new NotFoundHttpException();
         }
     } catch (EntityNotFoundException $e) {
         throw new NotFoundHttpException(null, $e);
     }
 }