You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
561B

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository;
  3. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  4. trait SectionStoreTrait
  5. {
  6. protected ?SectionInterface $section = null;
  7. public function setSection(SectionInterface $section):self
  8. {
  9. $this->section = $section;
  10. return $this;
  11. }
  12. public function getParents()
  13. {
  14. $query = $this->query->create();
  15. if ($this->section) {
  16. $query->filterBySection($this->section);
  17. }
  18. $query->filterIsParent();
  19. return $query->find();
  20. }
  21. }