src/Entity/Country.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CountryRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassCountryRepository::class)]
  6. #[ORM\Table(name'tb_countries')]
  7. #[ORM\HasLifecycleCallbacks]
  8. class Country
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type"integer"uniquetrue)]
  13.     private ?int $id;
  14.     #[ORM\Column(type'string'length50nullablefalse)]
  15.     private ?string $code;
  16.     #[ORM\Column(type'string'length100nullabletrue)]
  17.     private ?string $name;
  18.     #[ORM\Column(type'string'length50nullabletrue)]
  19.     private ?string $callingCode;
  20.     #[ORM\Column(type'boolean'nullabletrue)]
  21.     private ?bool $activated;
  22.     #[ORM\Column(type'datetime'nullabletrue)]
  23.     private \DateTimeInterface $createdAt;
  24.     #[ORM\Column(type'datetime'nullabletrue)]
  25.     private ?\DateTimeInterface $modifiedAt;
  26.     #[ORM\ManyToOne(targetEntityUser::class)]
  27.     private ?User $createdBy;
  28.     public function __construct()
  29.     {
  30.         $this->createdAt = new \DateTime();
  31.     }
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getCode(): ?string
  37.     {
  38.         return $this->code;
  39.     }
  40.     public function setCode(string $code): self
  41.     {
  42.         $this->code $code;
  43.         return $this;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->name;
  48.     }
  49.     public function setName(string $name): self
  50.     {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     public function getCallingCode(): ?string
  55.     {
  56.         return $this->callingCode;
  57.     }
  58.     public function setCallingCode(string $callingCode): self
  59.     {
  60.         $this->callingCode $callingCode;
  61.         return $this;
  62.     }
  63.     public function getActivated(): ?bool
  64.     {
  65.         return $this->activated;
  66.     }
  67.     public function setActivated(?bool $activated): self
  68.     {
  69.         $this->activated $activated;
  70.         return $this;
  71.     }
  72.     public function getCreatedAt(): ?\DateTimeInterface
  73.     {
  74.         return $this->createdAt;
  75.     }
  76.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  77.     {
  78.         $this->createdAt $createdAt;
  79.         return $this;
  80.     }
  81.     public function getModifiedAt(): ?\DateTimeInterface
  82.     {
  83.         return $this->modifiedAt;
  84.     }
  85.     public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
  86.     {
  87.         $this->modifiedAt $modifiedAt;
  88.         return $this;
  89.     }
  90.     public function getCreatedBy(): ?User
  91.     {
  92.         return $this->createdBy;
  93.     }
  94.     public function setCreatedBy(?User $createdBy): self
  95.     {
  96.         $this->createdBy $createdBy;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @ORM\PreUpdate
  101.      */
  102.     public function onUpdate() {
  103.         $this->modifiedAt = new \DateTime();
  104.     }
  105. }