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.

108 lines
2.4KB

  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. /**
  26. * @ORM\Column(type="string", length=256, nullable=true)
  27. */
  28. protected $hook;
  29. public function __construct()
  30. {
  31. $this->entries = new ArrayCollection();
  32. }
  33. public function __toString()
  34. {
  35. return $this->getTitle();
  36. }
  37. public function getWorkshopThematic(): ?WorkshopThematicInterface
  38. {
  39. return $this->workshopThematic;
  40. }
  41. public function setWorkshopThematic(WorkshopThematicInterface $workshopThematic): self
  42. {
  43. $this->workshopThematic = $workshopThematic;
  44. return $this;
  45. }
  46. public function getType(): ?TypeInterface
  47. {
  48. return $this->type;
  49. }
  50. public function setType(TypeInterface $type): self
  51. {
  52. $this->type = $type;
  53. return $this;
  54. }
  55. /**
  56. * @return Collection|EntryInterface[]
  57. */
  58. public function getEntries(): Collection
  59. {
  60. return $this->entries;
  61. }
  62. public function addEntry(EntryInterface $entry): self
  63. {
  64. if (!$this->entries->contains($entry)) {
  65. $this->entries[] = $entry;
  66. }
  67. return $this;
  68. }
  69. public function removeEntry(EntryInterface $entry): self
  70. {
  71. if ($this->entries->contains($entry)) {
  72. $this->entries->removeElement($entry);
  73. }
  74. return $this;
  75. }
  76. public function getHook(): ?string
  77. {
  78. return $this->hook;
  79. }
  80. public function setHook(string $hook): self
  81. {
  82. $this->hook = $hook;
  83. return $this;
  84. }
  85. }