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.

Workshop.php 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. }