From 52f4ea7aede39d18b0c63182b109564d9d251d28 Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Mon, 23 Jun 2014 17:15:19 +0200 Subject: [PATCH] rel #13914 : override getCategorie instead of introducing another getter --- library/Class/Album.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/library/Class/Album.php b/library/Class/Album.php index 1c5007c3555..43d55ed5672 100644 --- a/library/Class/Album.php +++ b/library/Class/Album.php @@ -352,9 +352,8 @@ class Class_Album extends Storm_Model_Abstract { /** @return array */ public function getHierarchy() { - $hierarchy = []; - $this->getCategory()->getHierarchyOn($hierarchy); + $this->getCategorie()->getHierarchyOn($hierarchy); return $hierarchy; } @@ -988,23 +987,16 @@ class Class_Album extends Storm_Model_Abstract { * @return string */ public function getAbsolutePath() { - return $this->getCategory()->getAbsolutePath().'>'.$this->getTitre(); + return $this->getCategorie()->getAbsolutePath() . '>' . $this->getTitre(); } - public function getCategory() { - if ($cat=$this->getCategorie()) - return $cat; - if ($cat=Class_AlbumCategorie::find($this->getCatId())) - return $cat; - $cat=Class_AlbumCategorie::newInstanceWithId($this->getCatId()) - ->setLibelle('Albums non classés') - ->setSousCategories([]); - return $cat; + public function getCategorie() { + return ($parent = parent::getCategorie()) ? + $parent : Class_AlbumCategorie::defaultCategory(); } - public function setAnnee($annee) { if (!$annee) return $this->_set('annee', ''); -- GitLab