src/Entity/CommunicationMethods.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommunicationMethodsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass: CommunicationMethodsRepository::class)]
  8. class CommunicationMethods
  9. {
  10. #[ORM\Id]
  11. #[ORM\GeneratedValue]
  12. #[ORM\Column(type: 'integer')]
  13. private $id;
  14. #[ORM\Column(type: 'string', length: 255)]
  15. private $method;
  16. #[ORM\Column(type: 'datetime')]
  17. private $modified;
  18. #[ORM\Column(type: 'datetime')]
  19. private $created;
  20. #[ORM\OneToMany(targetEntity: ClinicCommunicationMethods::class, mappedBy: 'communicationMethod', cascade: ['persist'])]
  21. private $clinicCommunicationMethods;
  22. public function __construct()
  23. {
  24. $date = new \DateTime("now", new \DateTimeZone('Asia/Dubai'));
  25. $this->setModified($date);
  26. if ($this->getCreated() == null)
  27. {
  28. $this->setCreated($date);
  29. }
  30. $this->clinicCommunicationMethods = new ArrayCollection();
  31. }
  32. public function getId(): ?int
  33. {
  34. return $this->id;
  35. }
  36. public function getMethod(): ?string
  37. {
  38. return $this->method;
  39. }
  40. public function setMethod(string $method): self
  41. {
  42. $this->method = $method;
  43. return $this;
  44. }
  45. public function getModified(): ?\DateTimeInterface
  46. {
  47. return $this->modified;
  48. }
  49. public function setModified(\DateTimeInterface $modified): self
  50. {
  51. $this->modified = $modified;
  52. return $this;
  53. }
  54. public function getCreated(): ?\DateTimeInterface
  55. {
  56. return $this->created;
  57. }
  58. public function setCreated(\DateTimeInterface $created): self
  59. {
  60. $this->created = $created;
  61. return $this;
  62. }
  63. /**
  64. * @return Collection|ClinicCommunicationMethods[]
  65. */
  66. public function getClinicCommunicationMethods(): Collection
  67. {
  68. return $this->clinicCommunicationMethods;
  69. }
  70. public function addClinicCommunicationMethod(ClinicCommunicationMethods $clinicCommunicationMethod): self
  71. {
  72. if (!$this->clinicCommunicationMethods->contains($clinicCommunicationMethod)) {
  73. $this->clinicCommunicationMethods[] = $clinicCommunicationMethod;
  74. $clinicCommunicationMethod->setCommunicationMethod($this);
  75. }
  76. return $this;
  77. }
  78. public function removeClinicCommunicationMethod(ClinicCommunicationMethods $clinicCommunicationMethod): self
  79. {
  80. if ($this->clinicCommunicationMethods->removeElement($clinicCommunicationMethod)) {
  81. // set the owning side to null (unless already changed)
  82. if ($clinicCommunicationMethod->getCommunicationMethod() === $this) {
  83. $clinicCommunicationMethod->setCommunicationMethod(null);
  84. }
  85. }
  86. return $this;
  87. }
  88. }