src/Entity/Charge.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. #[ORM\Entity(repositoryClassChargeRepository::class)]
  6. #[ORM\Table(name"charge")]
  7. class Charge
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue(strategy"AUTO")]
  11.     #[ORM\Column(type"integer")]
  12.     private ?int $id null;
  13.     #[ORM\Column(type"datetime")]
  14.     private \DateTimeInterface $createdAt;
  15.     #[ORM\Column(type"boolean")]
  16.     private bool $isDeleted false;
  17.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy"charges"cascade: ["persist"])]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?User $user;
  20.     #[ORM\Column(type"string"length255)]
  21.     #[Assert\Choice(callback"getTypes"multiplefalse)]
  22.     private ?string $type;
  23.     #[ORM\ManyToOne(targetEntityDisasterDeclaration::class, inversedBy"charges"cascade: ["persist"])]
  24.     #[ORM\JoinColumn(nullabletrue)]
  25.     private ?DisasterDeclaration $disasterDeclaration;
  26.     #[ORM\ManyToOne(targetEntityComplaintLetter::class, inversedBy"charges"cascade: ["persist"])]
  27.     #[ORM\JoinColumn(nullabletrue)]
  28.     private ?ComplaintLetter $complaintLetter;
  29.     #[ORM\ManyToOne(targetEntitySteal::class, inversedBy"charges"cascade: ["persist"])]
  30.     #[ORM\JoinColumn(nullabletrue)]
  31.     private ?Steal $steal;
  32.     #[ORM\Column(type"integer")]
  33.     private int $amount;
  34.     public function __construct()
  35.     {
  36.         $this->createdAt = new \DateTime();
  37.     }
  38.     public function __toString(): string
  39.     {
  40.         return "#" $this->id " - " $this->amount;
  41.     }
  42.     public static function getTypes(): array
  43.     {
  44.         return [
  45.             "disaster_declaration_routing",
  46.             "steal_routing",
  47.             "complaint_letter_routing",
  48.         ];
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getIsDeleted(): bool
  55.     {
  56.         return $this->isDeleted;
  57.     }
  58.     public function setIsDeleted(bool $isDeleted): self
  59.     {
  60.         $this->isDeleted $isDeleted;
  61.         return $this;
  62.     }
  63.     public function getType(): string
  64.     {
  65.         return $this->type;
  66.     }
  67.     public function setType(string $type): self
  68.     {
  69.         $this->type $type;
  70.         return $this;
  71.     }
  72.     public function getAmount(): int
  73.     {
  74.         return $this->amount;
  75.     }
  76.     public function setAmount(int $amount): self
  77.     {
  78.         $this->amount $amount;
  79.         return $this;
  80.     }
  81.     public function getCreatedAt(): \DateTimeInterface
  82.     {
  83.         return $this->createdAt;
  84.     }
  85.     public function getUser(): User
  86.     {
  87.         return $this->user;
  88.     }
  89.     public function setUser(User $user): self
  90.     {
  91.         $this->user $user;
  92.         return $this;
  93.     }
  94.     public function getDisasterDeclaration(): ?DisasterDeclaration
  95.     {
  96.         return $this->disasterDeclaration;
  97.     }
  98.     public function setDisasterDeclaration(?DisasterDeclaration $disasterDeclaration): self
  99.     {
  100.         $this->disasterDeclaration $disasterDeclaration;
  101.         return $this;
  102.     }
  103.     public function getSteal(): ?Steal
  104.     {
  105.         return $this->steal;
  106.     }
  107.     public function setSteal(?Steal $steal): self
  108.     {
  109.         $this->steal $steal;
  110.         return $this;
  111.     }
  112.     public function getComplaintLetter(): ?ComplaintLetter
  113.     {
  114.         return $this->complaintLetter;
  115.     }
  116.     public function setComplaintLetter(?ComplaintLetter $complaintLetter): self
  117.     {
  118.         $this->complaintLetter $complaintLetter;
  119.         return $this;
  120.     }
  121. }