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.

79 lines
1.8KB

  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="workshopThematic", cascade={"persist", "remove"}, fetch="EAGER")
  18. * @ORM\OrderBy({"position" = "ASC"})
  19. */
  20. protected $workshops;
  21. /**
  22. * @ORM\Column(type="string", length=255, nullable=true)
  23. */
  24. protected $color;
  25. public function __construct()
  26. {
  27. $this->workshops = new ArrayCollection();
  28. }
  29. public function __toString()
  30. {
  31. return $this->getTitle();
  32. }
  33. /**
  34. * @return Collection|WorkshopInterface[]
  35. */
  36. public function getWorkshops(): Collection
  37. {
  38. return $this->workshops;
  39. }
  40. public function addWorkshop(WorkshopInterface $workshop): self
  41. {
  42. if (!$this->workshops->contains($workshop)) {
  43. $this->workshops[] = $workshop;
  44. }
  45. return $this;
  46. }
  47. public function removeWorkshop(WorkshopInterface $workshop): self
  48. {
  49. if ($this->workshops->contains($workshop)) {
  50. $this->workshops->removeElement($workshop);
  51. }
  52. return $this;
  53. }
  54. public function getColor(): ?string
  55. {
  56. return $this->color;
  57. }
  58. public function setColor(?string $color): self
  59. {
  60. $this->color = $color;
  61. return $this;
  62. }
  63. }