lib/composer/TranslationBundle/src/VisualMedia/TranslationBundle/Model/BaseChannelModel.php line 28

Open in your IDE?
  1. <?php
  2. /**
  3. * Base Channel Model
  4. *
  5. * (c) Vincent van Waasbergen <v.vanwaasbergen@dappr.nl>
  6. * (c) Bertin van den Ham <b.vandenham@dappr.nl>
  7. */
  8. namespace VisualMedia\TranslationBundle\Model;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Query\Expr\Base;
  12. use VisualMedia\OrderBundle\Entity\BaseOrderItem;
  13. use VisualMedia\OrderBundle\Model\BaseOrderModel;
  14. use VisualMedia\TranslationBundle\Entity\BaseChannel;
  15. use VisualMedia\TranslationBundle\Entity\BaseDomain;
  16. /**
  17. * Base Channel Model
  18. *
  19. * @property ArrayCollection|BaseDomain[] $domains
  20. */
  21. class BaseChannelModel
  22. {
  23. /**
  24. * @param string $title
  25. */
  26. public function __construct(string $title = null)
  27. {
  28. $this->title = $title;
  29. $this->domains = new ArrayCollection();
  30. }
  31. /**
  32. * @return Collection|BaseDomain[]
  33. */
  34. public function getDomains(): Collection
  35. {
  36. return $this->domains;
  37. }
  38. /**
  39. * @param Collection|BaseDomain[] $domains
  40. *
  41. * @return BaseChannel
  42. */
  43. public function setDomains(Collection $domains): self
  44. {
  45. $this->domains = $domains;
  46. return $this;
  47. }
  48. /**
  49. *
  50. * @param BaseDomain $domain
  51. *
  52. * @return BaseChannel
  53. */
  54. public function addDomain(BaseDomain $domain): self
  55. {
  56. if (!$this->domains->contains($domain)) {
  57. $this->domains->add($domain);
  58. $domain->setChannel($this);
  59. }
  60. return $this;
  61. }
  62. /**
  63. * @param BaseDomain $domain
  64. *
  65. * @return $this
  66. */
  67. public function removeDomain(BaseDomain $domain): self
  68. {
  69. if ($this->domains->contains($domain)) {
  70. $this->domains->removeElement($domain);
  71. }
  72. return $this;
  73. }
  74. /**
  75. * @return string
  76. */
  77. public function __toString(): string
  78. {
  79. return (string)$this->title;
  80. }
  81. }