/** * Allows to know if a page has already visted * @param \Sdz\BlogBundle\Entity\Page $page */ public function hasAlreadyVisitedPage(\Sdz\BlogBundle\Entity\Page $page) { if ($this->pages !== null) { foreach ($this->pages as $currentPage) { if ($currentPage->getNom() == $page->getNom()) { return true; } } } return false; }