<?php
namespace App\Entity;
use App\Repository\CountryRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CountryRepository::class)]
#[ORM\Table(name: 'tb_countries')]
#[ORM\HasLifecycleCallbacks]
class Country
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer", unique: true)]
private ?int $id;
#[ORM\Column(type: 'string', length: 50, nullable: false)]
private ?string $code;
#[ORM\Column(type: 'string', length: 100, nullable: true)]
private ?string $name;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private ?string $callingCode;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $activated;
#[ORM\Column(type: 'datetime', nullable: true)]
private \DateTimeInterface $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTimeInterface $modifiedAt;
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $createdBy;
public function __construct()
{
$this->createdAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCallingCode(): ?string
{
return $this->callingCode;
}
public function setCallingCode(string $callingCode): self
{
$this->callingCode = $callingCode;
return $this;
}
public function getActivated(): ?bool
{
return $this->activated;
}
public function setActivated(?bool $activated): self
{
$this->activated = $activated;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getModifiedAt(): ?\DateTimeInterface
{
return $this->modifiedAt;
}
public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
{
$this->modifiedAt = $modifiedAt;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
/**
* @ORM\PreUpdate
*/
public function onUpdate() {
$this->modifiedAt = new \DateTime();
}
}