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.

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