src/Entity/Canal.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\Uid\Uuid;
  8. /**
  9. * @ORM\Entity(repositoryClass="App\Repository\CanalRepository")
  10. * @ORM\Table(name="canal", schema="perseo")
  11. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  12. */
  13. class Canal
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\Column(type="uuid", unique=true)
  18. * @ORM\GeneratedValue(strategy="CUSTOM")
  19. * @ORM\CustomIdGenerator(class="doctrine.uuid_generator")
  20. */
  21. protected $id;
  22. /**
  23. * @ORM\Column(type="string", nullable=false)
  24. */
  25. protected $nombre;
  26. /**
  27. * @ORM\Column(type="float", nullable=true, precision=2, options={"default": "0.00"})
  28. */
  29. protected $comision;
  30. /**
  31. * @ORM\Column(type="string", nullable=true)
  32. */
  33. protected $descripcion;
  34. /**
  35. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  36. */
  37. protected $deletedAt;
  38. /**
  39. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  40. * @Gedmo\Timestampable(on="update")
  41. */
  42. protected $updatedAt;
  43. /**
  44. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  45. * @Gedmo\Timestampable(on="create")
  46. */
  47. protected $createdAt;
  48. /**
  49. * @ORM\OneToMany(targetEntity="App\Entity\Valoracion", mappedBy="canal")
  50. */
  51. protected $valoraciones;
  52. /**
  53. * @ORM\OneToMany(targetEntity="App\Entity\Referencia", mappedBy="canal")
  54. */
  55. protected $referencias;
  56. /**
  57. * @ORM\OneToMany(targetEntity=\App\Entity\ValoracionesRelojesStock::class, mappedBy="plataformaPromocion")
  58. */
  59. private $valoracionesRelojesStocks;
  60. /**
  61. * @ORM\OneToMany(targetEntity=\App\Entity\AccionCompetencia::class, mappedBy="canal")
  62. */
  63. protected $accionesCompetencia;
  64. /**
  65. * @ORM\OneToMany(targetEntity="App\Entity\AccionAnuncio", mappedBy="canal")
  66. */
  67. protected $accionesAnuncio;
  68. /**
  69. * @ORM\OneToMany(targetEntity=\App\Entity\ActividadAbstract::class, mappedBy="canal")
  70. */
  71. private $actividades;
  72. /**
  73. * @ORM\OneToMany(targetEntity="App\Entity\Operacion", mappedBy="canal")
  74. */
  75. protected $operaciones;
  76. public function __construct()
  77. {
  78. $this->referencias = new ArrayCollection();
  79. $this->operaciones = new ArrayCollection();
  80. $this->valoraciones = new ArrayCollection();
  81. $this->accionesCompetencia = new ArrayCollection();
  82. $this->accionesAnuncio = new ArrayCollection();
  83. $this->actividades = new ArrayCollection();
  84. $this->valoracionesRelojesStocks = new ArrayCollection();
  85. }
  86. public function __toString(): string
  87. {
  88. return $this->getNombre()??'---';
  89. }
  90. public function getId(): ?Uuid
  91. {
  92. return $this->id;
  93. }
  94. public function getNombre(): ?string
  95. {
  96. return $this->nombre;
  97. }
  98. public function setNombre(string $nombre): self
  99. {
  100. $this->nombre = $nombre;
  101. return $this;
  102. }
  103. public function getComision(): ?float
  104. {
  105. return $this->comision;
  106. }
  107. public function setComision(float $comision): self
  108. {
  109. $this->comision = $comision;
  110. return $this;
  111. }
  112. public function getDeletedAt(): ?\DateTimeInterface
  113. {
  114. return $this->deletedAt;
  115. }
  116. public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  117. {
  118. $this->deletedAt = $deletedAt;
  119. return $this;
  120. }
  121. public function getUpdatedAt(): ?\DateTimeInterface
  122. {
  123. return $this->updatedAt;
  124. }
  125. public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  126. {
  127. $this->updatedAt = $updatedAt;
  128. return $this;
  129. }
  130. public function getCreatedAt(): ?\DateTimeInterface
  131. {
  132. return $this->createdAt;
  133. }
  134. public function setCreatedAt(\DateTimeInterface $createdAt): self
  135. {
  136. $this->createdAt = $createdAt;
  137. return $this;
  138. }
  139. /**
  140. * @return Collection|Promocion[]
  141. */
  142. public function getPromociones(): Collection
  143. {
  144. return $this->promociones;
  145. }
  146. public function addPromocione(Promocion $promocione): self
  147. {
  148. if (!$this->promociones->contains($promocione)) {
  149. $this->promociones[] = $promocione;
  150. $promocione->setCanal($this);
  151. }
  152. return $this;
  153. }
  154. public function removePromocione(Promocion $promocione): self
  155. {
  156. if ($this->promociones->removeElement($promocione)) {
  157. // set the owning side to null (unless already changed)
  158. if ($promocione->getCanal() === $this) {
  159. $promocione->setCanal(null);
  160. }
  161. }
  162. return $this;
  163. }
  164. /**
  165. * @return Collection|Referencia[]
  166. */
  167. public function getReferencias(): Collection
  168. {
  169. return $this->referencias;
  170. }
  171. public function addReferencia(Referencia $referencia): self
  172. {
  173. if (!$this->referencias->contains($referencia)) {
  174. $this->referencias[] = $referencia;
  175. $referencia->setCanal($this);
  176. }
  177. return $this;
  178. }
  179. public function removeReferencia(Referencia $referencia): self
  180. {
  181. if ($this->referencias->removeElement($referencia)) {
  182. // set the owning side to null (unless already changed)
  183. if ($referencia->getCanal() === $this) {
  184. $referencia->setCanal(null);
  185. }
  186. }
  187. return $this;
  188. }
  189. /**
  190. * @return Collection|Operacion[]
  191. */
  192. public function getOperaciones(): Collection
  193. {
  194. return $this->operaciones;
  195. }
  196. public function addOperacione(Operacion $operacione): self
  197. {
  198. if (!$this->operaciones->contains($operacione)) {
  199. $this->operaciones[] = $operacione;
  200. $operacione->setCanal($this);
  201. }
  202. return $this;
  203. }
  204. public function removeOperacione(Operacion $operacione): self
  205. {
  206. if ($this->operaciones->removeElement($operacione)) {
  207. // set the owning side to null (unless already changed)
  208. if ($operacione->getCanal() === $this) {
  209. $operacione->setCanal(null);
  210. }
  211. }
  212. return $this;
  213. }
  214. /**
  215. * @return Collection|Valoracion[]
  216. */
  217. public function getValoraciones(): Collection
  218. {
  219. return $this->valoraciones;
  220. }
  221. public function addValoracione(Valoracion $valoracione): self
  222. {
  223. if (!$this->valoraciones->contains($valoracione)) {
  224. $this->valoraciones[] = $valoracione;
  225. $valoracione->setCanal($this);
  226. }
  227. return $this;
  228. }
  229. public function removeValoracione(Valoracion $valoracione): self
  230. {
  231. if ($this->valoraciones->removeElement($valoracione)) {
  232. // set the owning side to null (unless already changed)
  233. if ($valoracione->getCanal() === $this) {
  234. $valoracione->setCanal(null);
  235. }
  236. }
  237. return $this;
  238. }
  239. public function getDescripcion(): ?string
  240. {
  241. return $this->descripcion;
  242. }
  243. public function setDescripcion(?string $descripcion): self
  244. {
  245. $this->descripcion = $descripcion;
  246. return $this;
  247. }
  248. /**
  249. * @return Collection<int, AccionCompetencia>
  250. */
  251. public function getAccionesCompetencia(): Collection
  252. {
  253. return $this->accionesCompetencia;
  254. }
  255. public function addAccionesCompetencium(AccionCompetencia $accionesCompetencium): self
  256. {
  257. if (!$this->accionesCompetencia->contains($accionesCompetencium)) {
  258. $this->accionesCompetencia->add($accionesCompetencium);
  259. $accionesCompetencium->setCanal($this);
  260. }
  261. return $this;
  262. }
  263. public function removeAccionesCompetencium(AccionCompetencia $accionesCompetencium): self
  264. {
  265. if ($this->accionesCompetencia->removeElement($accionesCompetencium)) {
  266. // set the owning side to null (unless already changed)
  267. if ($accionesCompetencium->getCanal() === $this) {
  268. $accionesCompetencium->setCanal(null);
  269. }
  270. }
  271. return $this;
  272. }
  273. /**
  274. * @return Collection<int, AccionAnuncio>
  275. */
  276. public function getAccionesAnuncio(): Collection
  277. {
  278. return $this->accionesAnuncio;
  279. }
  280. public function addAccionesAnuncio(AccionAnuncio $accionesAnuncio): self
  281. {
  282. if (!$this->accionesAnuncio->contains($accionesAnuncio)) {
  283. $this->accionesAnuncio->add($accionesAnuncio);
  284. $accionesAnuncio->setCanal($this);
  285. }
  286. return $this;
  287. }
  288. public function removeAccionesAnuncio(AccionAnuncio $accionesAnuncio): self
  289. {
  290. if ($this->accionesAnuncio->removeElement($accionesAnuncio)) {
  291. // set the owning side to null (unless already changed)
  292. if ($accionesAnuncio->getCanal() === $this) {
  293. $accionesAnuncio->setCanal(null);
  294. }
  295. }
  296. return $this;
  297. }
  298. /**
  299. * @return Collection<int, ActividadAbstract>
  300. */
  301. public function getActividades(): Collection
  302. {
  303. return $this->actividades;
  304. }
  305. public function addActividade(ActividadAbstract $actividade): static
  306. {
  307. if (!$this->actividades->contains($actividade)) {
  308. $this->actividades->add($actividade);
  309. $actividade->setCanal($this);
  310. }
  311. return $this;
  312. }
  313. public function removeActividade(ActividadAbstract $actividade): static
  314. {
  315. if ($this->actividades->removeElement($actividade)) {
  316. // set the owning side to null (unless already changed)
  317. if ($actividade->getCanal() === $this) {
  318. $actividade->setCanal(null);
  319. }
  320. }
  321. return $this;
  322. }
  323. /**
  324. * @return Collection<int, ValoracionesRelojesStock>
  325. */
  326. public function getValoracionesRelojesStocks(): Collection
  327. {
  328. return $this->valoracionesRelojesStocks;
  329. }
  330. public function addValoracionesRelojesStock(ValoracionesRelojesStock $valoracionesRelojesStock): static
  331. {
  332. if (!$this->valoracionesRelojesStocks->contains($valoracionesRelojesStock)) {
  333. $this->valoracionesRelojesStocks->add($valoracionesRelojesStock);
  334. $valoracionesRelojesStock->setPlataformaPromocion($this);
  335. }
  336. return $this;
  337. }
  338. public function removeValoracionesRelojesStock(ValoracionesRelojesStock $valoracionesRelojesStock): static
  339. {
  340. if ($this->valoracionesRelojesStocks->removeElement($valoracionesRelojesStock)) {
  341. // set the owning side to null (unless already changed)
  342. if ($valoracionesRelojesStock->getPlataformaPromocion() === $this) {
  343. $valoracionesRelojesStock->setPlataformaPromocion(null);
  344. }
  345. }
  346. return $this;
  347. }
  348. }