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.

40 lines
984B

  1. <?php
  2. namespace Lc\CaracoleBundle\Factory\Section;
  3. use App\Entity\Section\Opening;
  4. use Lc\CaracoleBundle\Container\Section\OpeningContainer;
  5. use Lc\CaracoleBundle\Context\SectionContextTrait;
  6. use Lc\CaracoleBundle\Model\Section\SectionInterface;
  7. use Lc\SovBundle\Factory\AbstractFactory;
  8. use Lc\SovBundle\Model\User\GroupUserInterface;
  9. class OpeningFactory extends AbstractFactory
  10. {
  11. public function create(
  12. SectionInterface $section,
  13. int $day = null,
  14. \DateTime $timeStart = null,
  15. \DateTime $timeEnd = null,
  16. GroupUserInterface $groupUser = null
  17. ): Opening {
  18. $class = OpeningContainer::getEntityFqcn();
  19. $opening = new $class;
  20. $opening->setSection($section);
  21. if($day) {
  22. $opening->setDay($day);
  23. }
  24. $opening->setTimeStart($timeStart);
  25. $opening->setTimeEnd($timeEnd);
  26. $opening->setGroupUser($groupUser);
  27. return $opening;
  28. }
  29. }