src/Entity/ComplaintLetter.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ComplaintLetterRepository;
  4. use DateTime;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. #[ORM\Entity(repositoryClassComplaintLetterRepository::class)]
  9. #[ORM\Table(name'complaint_letter')]
  10. class ComplaintLetter
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue(strategy"AUTO")]
  14.     #[ORM\Column(type"integer")]
  15.     private ?int $id;
  16.     #[ORM\Column(type'datetime')]
  17.     private ?DateTime $createdAt;
  18.     #[ORM\Column(type"boolean")]
  19.     private bool $isDeleted false;
  20.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'complaintLetters')]
  21.     #[ORM\JoinColumn(nullablefalse)]
  22.     private User $user;
  23.     /**
  24.      * @var Collection<Charge>|array<Charge>
  25.      */
  26.     #[ORM\OneToMany(mappedBy'complaintLetter'targetEntityCharge::class)]
  27.     private Collection|array $charges;
  28.     /**
  29.      * @var Collection<InsuranceDisasterDeclaration>|array<Charge>
  30.      */
  31.     #[ORM\OneToMany(mappedBy'complaintLetter'targetEntityInsuranceDisasterDeclaration::class)]
  32.     private Collection|array $insuranceDisasterDeclarations;
  33.     #[Assert\Choice(callback'getCivilities'multiplefalse)]
  34.     #[ORM\Column(type'string'length255)]
  35.     private ?string $civility;
  36.     #[ORM\Column(type'boolean')]
  37.     private bool $isInsured;
  38.     #[ORM\Column(type'datetime')]
  39.     private DateTime $date;
  40.     #[ORM\Column(type'string'length255)]
  41.     private string $address;
  42.     #[ORM\Column(type'string'length255)]
  43.     private string $type;
  44.     #[ORM\Column(type'text')]
  45.     private string $circumstance;
  46.     #[ORM\ManyToOne(targetEntityInsurance::class, inversedBy'complaintLetters')]
  47.     #[ORM\JoinColumn(nullabletrue)]
  48.     private ?Insurance $insurance;
  49.     /**
  50.      * @var Collection<Item>|array<Item>
  51.      */
  52.     #[ORM\ManyToMany(targetEntityItem::class, inversedBy'complaintLetters')]
  53.     private Collection|array $items;
  54.     #[ORM\Column(type'text')]
  55.     private string $degradation;
  56.     #[ORM\Column(type'text')]
  57.     private string $evaluation;
  58.     public function __construct()
  59.     {
  60.         $this->createdAt = new DateTime();
  61.         $this->items = new \Doctrine\Common\Collections\ArrayCollection();
  62.     }
  63.     public function __toString()
  64.     {
  65.         return "#" $this->id " - " $this->createdAt->format("d/m/Y H:i");
  66.     }
  67.     public static function getCivilities(): array
  68.     {
  69.         $arr = [
  70.             "Mr",
  71.             "Mme"
  72.         ];
  73.         return array_combine($arr$arr);
  74.     }
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     /**
  80.      * Set civility
  81.      *
  82.      * @param string $civility
  83.      *
  84.      * @return ComplaintLetter
  85.      */
  86.     public function setCivility($civility)
  87.     {
  88.         $this->civility $civility;
  89.         return $this;
  90.     }
  91.     /**
  92.      * Get civility
  93.      *
  94.      * @return string
  95.      */
  96.     public function getCivility()
  97.     {
  98.         return $this->civility;
  99.     }
  100.     /**
  101.      * Set isInsured
  102.      *
  103.      * @param boolean $isInsured
  104.      *
  105.      * @return ComplaintLetter
  106.      */
  107.     public function setIsInsured($isInsured)
  108.     {
  109.         $this->isInsured $isInsured;
  110.         return $this;
  111.     }
  112.     /**
  113.      * Get isInsured
  114.      *
  115.      * @return bool
  116.      */
  117.     public function getIsInsured()
  118.     {
  119.         return $this->isInsured;
  120.     }
  121.     /**
  122.      * Set date
  123.      *
  124.      * @param DateTime $date
  125.      *
  126.      * @return ComplaintLetter
  127.      */
  128.     public function setDate($date)
  129.     {
  130.         $this->date $date;
  131.         return $this;
  132.     }
  133.     /**
  134.      * Get date
  135.      *
  136.      * @return DateTime
  137.      */
  138.     public function getDate()
  139.     {
  140.         return $this->date;
  141.     }
  142.     /**
  143.      * Set address
  144.      *
  145.      * @param string $address
  146.      *
  147.      * @return ComplaintLetter
  148.      */
  149.     public function setAddress($address)
  150.     {
  151.         $this->address $address;
  152.         return $this;
  153.     }
  154.     /**
  155.      * Get address
  156.      *
  157.      * @return string
  158.      */
  159.     public function getAddress()
  160.     {
  161.         return $this->address;
  162.     }
  163.     /**
  164.      * Set type
  165.      *
  166.      * @param string $type
  167.      *
  168.      * @return ComplaintLetter
  169.      */
  170.     public function setType($type)
  171.     {
  172.         $this->type $type;
  173.         return $this;
  174.     }
  175.     /**
  176.      * Get type
  177.      *
  178.      * @return string
  179.      */
  180.     public function getType()
  181.     {
  182.         return $this->type;
  183.     }
  184.     /**
  185.      * Set circumstance
  186.      *
  187.      * @param string $circumstance
  188.      *
  189.      * @return ComplaintLetter
  190.      */
  191.     public function setCircumstance($circumstance)
  192.     {
  193.         $this->circumstance $circumstance;
  194.         return $this;
  195.     }
  196.     /**
  197.      * Get circumstance
  198.      *
  199.      * @return string
  200.      */
  201.     public function getCircumstance()
  202.     {
  203.         return $this->circumstance;
  204.     }
  205.     /**
  206.      * Set degradation
  207.      *
  208.      * @param string $degradation
  209.      *
  210.      * @return ComplaintLetter
  211.      */
  212.     public function setDegradation($degradation)
  213.     {
  214.         $this->degradation $degradation;
  215.         return $this;
  216.     }
  217.     /**
  218.      * Get degradation
  219.      *
  220.      * @return string
  221.      */
  222.     public function getDegradation()
  223.     {
  224.         return $this->degradation;
  225.     }
  226.     /**
  227.      * Set evaluation
  228.      *
  229.      * @param string $evaluation
  230.      *
  231.      * @return ComplaintLetter
  232.      */
  233.     public function setEvaluation($evaluation)
  234.     {
  235.         $this->evaluation $evaluation;
  236.         return $this;
  237.     }
  238.     /**
  239.      * Get evaluation
  240.      *
  241.      * @return string
  242.      */
  243.     public function getEvaluation()
  244.     {
  245.         return $this->evaluation;
  246.     }
  247.     /**
  248.      * Set insurance
  249.      *
  250.      * @param \App\Entity\Insurance $insurance
  251.      *
  252.      * @return ComplaintLetter
  253.      */
  254.     public function setInsurance(\App\Entity\Insurance $insurance)
  255.     {
  256.         $this->insurance $insurance;
  257.         return $this;
  258.     }
  259.     /**
  260.      * Get insurance
  261.      *
  262.      * @return \App\Entity\Insurance
  263.      */
  264.     public function getInsurance()
  265.     {
  266.         return $this->insurance;
  267.     }
  268.     /**
  269.      * Add item
  270.      *
  271.      * @param \App\Entity\Item $item
  272.      *
  273.      * @return ComplaintLetter
  274.      */
  275.     public function addItem(\App\Entity\Item $item)
  276.     {
  277.         $this->items[] = $item;
  278.         return $this;
  279.     }
  280.     /**
  281.      * Remove item
  282.      *
  283.      * @param \App\Entity\Item $item
  284.      */
  285.     public function removeItem(\App\Entity\Item $item)
  286.     {
  287.         $this->items->removeElement($item);
  288.     }
  289.     /**
  290.      * Get items
  291.      *
  292.      * @return \Doctrine\Common\Collections\Collection
  293.      */
  294.     public function getItems()
  295.     {
  296.         return $this->items;
  297.     }
  298.     /**
  299.      * Set user
  300.      *
  301.      * @param \App\Entity\User $user
  302.      *
  303.      * @return ComplaintLetter
  304.      */
  305.     public function setUser(?\App\Entity\User $user)
  306.     {
  307.         $this->user $user;
  308.         return $this;
  309.     }
  310.     /**
  311.      * Get user
  312.      *
  313.      * @return \App\Entity\User
  314.      */
  315.     public function getUser()
  316.     {
  317.         return $this->user;
  318.     }
  319.     /**
  320.      * Add insuranceDisasterDeclaration
  321.      *
  322.      * @param \App\Entity\InsuranceDisasterDeclaration $insuranceDisasterDeclaration
  323.      *
  324.      * @return ComplaintLetter
  325.      */
  326.     public function addInsuranceDisasterDeclaration(\App\Entity\InsuranceDisasterDeclaration $insuranceDisasterDeclaration)
  327.     {
  328.         $this->insuranceDisasterDeclarations[] = $insuranceDisasterDeclaration;
  329.         return $this;
  330.     }
  331.     /**
  332.      * Remove insuranceDisasterDeclaration
  333.      *
  334.      * @param \App\Entity\InsuranceDisasterDeclaration $insuranceDisasterDeclaration
  335.      */
  336.     public function removeInsuranceDisasterDeclaration(\App\Entity\InsuranceDisasterDeclaration $insuranceDisasterDeclaration)
  337.     {
  338.         $this->insuranceDisasterDeclarations->removeElement($insuranceDisasterDeclaration);
  339.     }
  340.     /**
  341.      * Get insuranceDisasterDeclarations
  342.      *
  343.      * @return \Doctrine\Common\Collections\Collection
  344.      */
  345.     public function getInsuranceDisasterDeclarations()
  346.     {
  347.         return $this->insuranceDisasterDeclarations;
  348.     }
  349.     /**
  350.      * Add charge
  351.      *
  352.      * @param \App\Entity\Charge $charge
  353.      *
  354.      * @return ComplaintLetter
  355.      */
  356.     public function addCharge(\App\Entity\Charge $charge)
  357.     {
  358.         $this->charges[] = $charge;
  359.         return $this;
  360.     }
  361.     /**
  362.      * Remove charge
  363.      *
  364.      * @param \App\Entity\Charge $charge
  365.      */
  366.     public function removeCharge(\App\Entity\Charge $charge)
  367.     {
  368.         $this->charges->removeElement($charge);
  369.     }
  370.     /**
  371.      * Get charges
  372.      *
  373.      * @return \Doctrine\Common\Collections\Collection
  374.      */
  375.     public function getCharges()
  376.     {
  377.         return $this->charges;
  378.     }
  379.     /**
  380.      * Set createdAt
  381.      *
  382.      * @param DateTime $createdAt
  383.      *
  384.      * @return ComplaintLetter
  385.      */
  386.     public function setCreatedAt($createdAt)
  387.     {
  388.         $this->createdAt $createdAt;
  389.         return $this;
  390.     }
  391.     /**
  392.      * Get createdAt
  393.      *
  394.      * @return DateTime
  395.      */
  396.     public function getCreatedAt()
  397.     {
  398.         return $this->createdAt;
  399.     }
  400.     /**
  401.      * Set isDeleted
  402.      *
  403.      * @param boolean $isDeleted
  404.      *
  405.      * @return ComplaintLetter
  406.      */
  407.     public function setIsDeleted($isDeleted)
  408.     {
  409.         $this->isDeleted $isDeleted;
  410.         return $this;
  411.     }
  412.     /**
  413.      * Get isDeleted
  414.      *
  415.      * @return boolean
  416.      */
  417.     public function getIsDeleted()
  418.     {
  419.         return $this->isDeleted;
  420.     }
  421. }