section = $section; return $this; } public function isSectionDefined(): bool { return isset($this->section) && $this->section; } public function addFilterBySectionOptionnal(RepositoryQueryInterface $query): StoreInterface { if($this->isSectionDefined()) { $query->filterBySection($this->section); } return $this; } public function addFilterBySectionRequired(RepositoryQueryInterface $query): StoreInterface { $this->addFilterBySectionOptionnal($query); if(!$this->isSectionDefined()) { throw new \ErrorException('La Section doit être définie dans '.get_class($this)); } return $this; } public function getParents() { $query = $this->query->create(); if ($this->section) { $query->filterBySection($this->section); } $query->filterIsParent(); return $query->find(); } }