src/Entity/LossReport.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LossReportRepository;
  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(repositoryClassLossReportRepository::class)]
  9. #[ORM\Table(name'loss_report')]
  10. class LossReport {
  11.     #[ORM\Column(type'boolean')]
  12.     private bool $isDeleted false;
  13.     #[ORM\Column(name'createdAt'type'datetime')]
  14.     private DateTime $createdAt;
  15.     #[ORM\Id]
  16.     #[ORM\Column(name'id'type'integer')]
  17.     #[ORM\GeneratedValue(strategy'AUTO')]
  18.     private ?int $id;
  19.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'lossReports')]
  20.     #[ORM\JoinColumn(nullablefalse)]
  21.     private User $user;
  22.     #[ORM\ManyToMany(targetEntityItem::class, inversedBy'lossReports')]
  23.     private Collection|array $items;
  24.     #[ORM\ManyToMany(targetEntityPaymentMethod::class, inversedBy'lossReports')]
  25.     private Collection|array $paymentMethods;
  26.     #[ORM\Column(name'lossDate'type'datetimetz')]
  27.     private DateTime $lossDate;
  28.     #[ORM\Column(type'datetime'nullabletrue)]
  29.     private DateTime $beginTime;
  30.     #[Assert\Expression("this.getEndTime() > this.getBeginTime()"message:"La fin de la plage horaire doit être après son début.")]
  31.     #[ORM\Column(type'datetime'nullabletrue)]
  32.     private ?DateTime $endTime;
  33.     #[ORM\Column(name'lossCity'type'string'length255)]
  34.     private string $lossCity;
  35.     #[ORM\Column(name'placeType'type'string'length255)]
  36.     private string $placeType;
  37.     #[ORM\Column(name'detail'type'text'nullabletrue)]
  38.     private ?string $detail;
  39.     public function __construct() {
  40.         $this->createdAt = new DateTime();
  41.         $this->items = new \Doctrine\Common\Collections\ArrayCollection();
  42.         $this->paymentMethods = new \Doctrine\Common\Collections\ArrayCollection();
  43.     }
  44.     public function __toString() {
  45.         return "#" $this->id " - " $this->createdAt->format("d/m/Y H:i");
  46.     }
  47.     /**
  48.      *
  49.      */
  50.     public static function getPlacesTypes(){
  51.         $arr = [
  52.             'Lieu de perte ignoré',
  53.             'Dans la rue',
  54.             'Dans les couloirs d\'une station de Métro',
  55.             'Dans les couloirs d\'une station de RER',
  56.             'Dans les transports en commun',
  57.             'Dans un aéroport',
  58.             'Dans un avion',
  59.             'Dans un bar',
  60.             'Dans un Bateau',
  61.             'Dans un bus "Urbain"',
  62.             'Dans un car "Grande ligne"',
  63.             'Dans un car de "voyage"',
  64.             'Dans un cinéma',
  65.             'Dans un espace privé',
  66.             'Dans un espace public',
  67.             'Dans un magasin',
  68.             'Dans un magasin "grande surface"',
  69.             'Dans un musée',
  70.             'Dans un restaurant',
  71.             'Dans un salon grand public',
  72.             'Dans un salon professionnel ',
  73.             'Dans un stade ',
  74.             'Dans un taxi',
  75.             'Dans un train "Grande ligne"',
  76.             'Dans un train "Intercités"',
  77.             'Dans un train "TER"',
  78.             'Dans un train "TGV"',
  79.             'Dans un train de banlieue "Transilien"',
  80.             'Dans un tramway',
  81.             'Dans un vestiaire sportif',
  82.             'dans un VTC',
  83.             'Dans une boutique',
  84.             'Dans une enceinte sportive',
  85.             'Dans une foire exposition',
  86.             'Dans une gare férroviaire ',
  87.             'Dans une gare maritime',
  88.             'Dans une gare routiére',
  89.             'Dans une rame "RER"',
  90.             'Dans une rame de "Métro"',
  91.             'Devant un collège',
  92.             'Devant un lycée ',
  93.             'Devant une école',
  94.             'Lors d’un concert',
  95.             'Lors d’un match',
  96.             'Lors d’un spectacle',
  97.             'Lors d’une exposition',
  98.             'Sur la terrasse d’un bar',
  99.             'Sur la terrasse d’un commerce',
  100.             'Sur la terrasse d’un restaurant',
  101.             'Sur le marché',
  102.             'Sur mon lieu de travail ',
  103.         ];
  104.         return array_combine($arr$arr);
  105.     }
  106.     /**
  107.      * Get id
  108.      *
  109.      * @return int
  110.      */
  111.     public function getId() {
  112.         return $this->id;
  113.     }
  114.     /**
  115.      * Set lossDate
  116.      *
  117.      * @param DateTime $lossDate
  118.      *
  119.      * @return LossReport
  120.      */
  121.     public function setLossDate($lossDate) {
  122.         $this->lossDate $lossDate;
  123.         return $this;
  124.     }
  125.     /**
  126.      * Get lossDate
  127.      *
  128.      * @return DateTime
  129.      */
  130.     public function getLossDate() {
  131.         return $this->lossDate;
  132.     }
  133.     /**
  134.      * Set lossCity
  135.      *
  136.      * @param string $lossCity
  137.      *
  138.      * @return LossReport
  139.      */
  140.     public function setLossCity($lossCity) {
  141.         $this->lossCity $lossCity;
  142.         return $this;
  143.     }
  144.     /**
  145.      * Get lossCity
  146.      *
  147.      * @return string
  148.      */
  149.     public function getLossCity() {
  150.         return $this->lossCity;
  151.     }
  152.     /**
  153.      * Set placeType
  154.      *
  155.      * @param string $placeType
  156.      *
  157.      * @return LossReport
  158.      */
  159.     public function setPlaceType($placeType) {
  160.         $this->placeType $placeType;
  161.         return $this;
  162.     }
  163.     /**
  164.      * Get placeType
  165.      *
  166.      * @return string
  167.      */
  168.     public function getPlaceType() {
  169.         return $this->placeType;
  170.     }
  171.     /**
  172.      * Set detail
  173.      *
  174.      * @param string $detail
  175.      *
  176.      * @return LossReport
  177.      */
  178.     public function setDetail($detail) {
  179.         $this->detail $detail;
  180.         return $this;
  181.     }
  182.     /**
  183.      * Get detail
  184.      *
  185.      * @return string
  186.      */
  187.     public function getDetail() {
  188.         return $this->detail;
  189.     }
  190.     /**
  191.      * Set user
  192.      *
  193.      * @param \App\Entity\User $user
  194.      *
  195.      * @return LossReport
  196.      */
  197.     public function setUser(\App\Entity\User $user) {
  198.         $this->user $user;
  199.         return $this;
  200.     }
  201.     /**
  202.      * Get user
  203.      *
  204.      * @return \App\Entity\User
  205.      */
  206.     public function getUser() {
  207.         return $this->user;
  208.     }
  209.     /**
  210.      * Add item
  211.      *
  212.      * @param \App\Entity\Item $item
  213.      *
  214.      * @return LossReport
  215.      */
  216.     public function addItem(\App\Entity\Item $item) {
  217.         $this->items[] = $item;
  218.         return $this;
  219.     }
  220.     /**
  221.      * Remove item
  222.      *
  223.      * @param \App\Entity\Item $item
  224.      */
  225.     public function removeItem(\App\Entity\Item $item) {
  226.         $this->items->removeElement($item);
  227.     }
  228.     /**
  229.      * Get items
  230.      *
  231.      * @return \Doctrine\Common\Collections\Collection
  232.      */
  233.     public function getItems() {
  234.         return $this->items;
  235.     }
  236.     /**
  237.      * Add paymentMethod
  238.      *
  239.      * @param \App\Entity\PaymentMethod $paymentMethod
  240.      *
  241.      * @return LossReport
  242.      */
  243.     public function addPaymentMethod(\App\Entity\PaymentMethod $paymentMethod) {
  244.         $this->paymentMethods[] = $paymentMethod;
  245.         return $this;
  246.     }
  247.     /**
  248.      * Remove paymentMethod
  249.      *
  250.      * @param \App\Entity\PaymentMethod $paymentMethod
  251.      */
  252.     public function removePaymentMethod(\App\Entity\PaymentMethod $paymentMethod) {
  253.         $this->paymentMethods->removeElement($paymentMethod);
  254.     }
  255.     /**
  256.      * Get paymentMethods
  257.      *
  258.      * @return \Doctrine\Common\Collections\Collection
  259.      */
  260.     public function getPaymentMethods() {
  261.         return $this->paymentMethods;
  262.     }
  263.     /**
  264.      * Set createdAt
  265.      *
  266.      * @param DateTime $createdAt
  267.      *
  268.      * @return LossReport
  269.      */
  270.     public function setCreatedAt($createdAt) {
  271.         $this->createdAt $createdAt;
  272.         return $this;
  273.     }
  274.     /**
  275.      * Get createdAt
  276.      *
  277.      * @return DateTime
  278.      */
  279.     public function getCreatedAt() {
  280.         return $this->createdAt;
  281.     }
  282.     /**
  283.      * Set beginTime
  284.      *
  285.      * @param DateTime $beginTime
  286.      *
  287.      * @return LossReport
  288.      */
  289.     public function setBeginTime($beginTime) {
  290.         $this->beginTime $beginTime;
  291.         return $this;
  292.     }
  293.     /**
  294.      * Get beginTime
  295.      *
  296.      * @return DateTime
  297.      */
  298.     public function getBeginTime() {
  299.         return $this->beginTime;
  300.     }
  301.     /**
  302.      * Set endTime
  303.      *
  304.      * @param DateTime $endTime
  305.      *
  306.      * @return LossReport
  307.      */
  308.     public function setEndTime($endTime) {
  309.         $this->endTime $endTime;
  310.         return $this;
  311.     }
  312.     /**
  313.      * Get endTime
  314.      *
  315.      * @return DateTime
  316.      */
  317.     public function getEndTime() {
  318.         return $this->endTime;
  319.     }
  320.     /**
  321.      * Set isDeleted
  322.      *
  323.      * @param boolean $isDeleted
  324.      *
  325.      * @return LossReport
  326.      */
  327.     public function setIsDeleted($isDeleted)
  328.     {
  329.         $this->isDeleted $isDeleted;
  330.         return $this;
  331.     }
  332.     /**
  333.      * Get isDeleted
  334.      *
  335.      * @return boolean
  336.      */
  337.     public function getIsDeleted()
  338.     {
  339.         return $this->isDeleted;
  340.     }
  341. }