Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

91 lines
2.1KB

  1. <?php
  2. namespace Lc\PietroBundle\Model\Workshop;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Lc\SovBundle\Doctrine\EntityInterface;
  7. use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
  8. /**
  9. * @ORM\MappedSuperclass()
  10. */
  11. abstract class Workshop extends AbstractFullEntity implements WorkshopInterface, EntityInterface
  12. {
  13. /**
  14. * @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Workshop\WorkshopThematicInterface", inversedBy="workshops")
  15. */
  16. protected $workshopThematic;
  17. /**
  18. * @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Workshop\TypeInterface", inversedBy="workshops")
  19. */
  20. protected $type;
  21. /**
  22. * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Workshop\EntryInterface", mappedBy="workshop", cascade={"persist", "remove"})
  23. */
  24. protected $entries;
  25. public function __construct()
  26. {
  27. $this->entries = new ArrayCollection();
  28. }
  29. public function __toString()
  30. {
  31. return $this->getTitle();
  32. }
  33. public function getWorkshopThematic(): ?WorkshopThematicInterface
  34. {
  35. return $this->workshopThematic;
  36. }
  37. public function setWorkshopThematic(WorkshopThematicInterface $workshopThematic): self
  38. {
  39. $this->workshopThematic = $workshopThematic;
  40. return $this;
  41. }
  42. public function getType(): ?TypeInterface
  43. {
  44. return $this->type;
  45. }
  46. public function setType(TypeInterface $type): self
  47. {
  48. $this->type = $type;
  49. return $this;
  50. }
  51. /**
  52. * @return Collection|EntryInterface[]
  53. */
  54. public function getEntries(): Collection
  55. {
  56. return $this->entries;
  57. }
  58. public function addEntry(EntryInterface $entry): self
  59. {
  60. if (!$this->entries->contains($entry)) {
  61. $this->entries[] = $entry;
  62. }
  63. return $this;
  64. }
  65. public function removeEntry(EntryInterface $entry): self
  66. {
  67. if ($this->entries->contains($entry)) {
  68. $this->entries->removeElement($entry);
  69. }
  70. return $this;
  71. }
  72. }