/** * Return a similar articles by category * @param Article $article * @return Article array */ public function getSimilarArticlesByCategory(Article $article) { $category = $article->getCategory(); $similarArticles = $this->articleRepository->findBy(array('category' => $category), array('date' => 'ASC'), 3); unset($similarArticles[array_search($article, $similarArticles)]); return $similarArticles; }
/** * {@inheritDoc} */ public function getCategory() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCategory', array()); return parent::getCategory(); }