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.

75 lines
1.7KB

  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. use Lc\SovBundle\Model\File\FileInterface;
  9. /**
  10. * @ORM\MappedSuperclass()
  11. */
  12. abstract class WorkshopThematic extends AbstractFullEntity implements WorkshopThematicInterface, EntityInterface
  13. {
  14. /**
  15. * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Workshop\WorkshopInterface", mappedBy="thematic", cascade={"persist", "remove"})
  16. */
  17. protected $workshops;
  18. /**
  19. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\File\FileInterface", cascade={"persist", "remove"})
  20. */
  21. protected $image;
  22. public function __construct()
  23. {
  24. $this->workshops = new ArrayCollection();
  25. }
  26. public function __toString()
  27. {
  28. return $this->getTitle();
  29. }
  30. /**
  31. * @return Collection|WorkshopInterface[]
  32. */
  33. public function getWorkshops(): Collection
  34. {
  35. return $this->workshops;
  36. }
  37. public function addWorkshop(WorkshopInterface $workshop): self
  38. {
  39. if (!$this->workshops->contains($workshop)) {
  40. $this->workshops[] = $workshop;
  41. }
  42. return $this;
  43. }
  44. public function removeWorkshop(WorkshopInterface $workshop): self
  45. {
  46. if ($this->workshops->contains($workshop)) {
  47. $this->workshops->removeElement($workshop);
  48. }
  49. return $this;
  50. }
  51. public function getImage(): ?FileInterface
  52. {
  53. return $this->image;
  54. }
  55. public function setImage(?FileInterface $image): self
  56. {
  57. $this->image = $image;
  58. return $this;
  59. }
  60. }