src/Entity/Search.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. #[ORM\Entity(repositoryClass"App\Repository\SearchRepository")]
  7. #[ORM\Table(name"search")]
  8. class Search
  9. {
  10.     #[ORM\Column(type"string"length255nullabletrue)]
  11.     private ?string $target null;
  12.     #[ORM\Column(name"createdAt"type"datetime")]
  13.     private DateTime $createdAt;
  14.     #[ORM\Column(type"boolean")]
  15.     private bool $isDeleted false;
  16.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy"searchs")]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private User $user;
  19.     #[ORM\Column(type"integer")]
  20.     #[ORM\Id]
  21.     #[ORM\GeneratedValue(strategy"AUTO")]
  22.     private ?int $id;
  23.     #[ORM\Column(name"brand"type"string"length255nullabletrue)]
  24.     #[Assert\NotBlank(message'Ce champ est obligatoire')]
  25.     private ?string $brand null;
  26.     #[ORM\Column(type"boolean")]
  27.     private bool $sendNotificationToOwner false;
  28.     #[ORM\Column(name"modelNumber"type"string"length255nullabletrue)]
  29.     private ?string $modelNumber null;
  30.     #[ORM\Column(name"serialNumber"type"string"length255nullabletrue)]
  31.     private ?string $serialNumber null;
  32.     #[ORM\Column(name"registrationNumber"type"string"length255nullabletrue)]
  33.     private ?string $registrationNumber null;
  34.     #[ORM\Column(name"imeiNumber"type"string"length255nullabletrue)]
  35.     private ?string $imeiNumber null;
  36.     public function __construct()
  37.     {
  38.         $this->createdAt = new DateTime();
  39.     }
  40.     public function __toString()
  41.     {
  42.         return "#" $this->id " - " $this->createdAt->format("d/m/Y H:i");
  43.     }
  44.     /**
  45.      *
  46.      */
  47.     public static function getTargets()
  48.     {
  49.         $arr = [
  50.             'Véhicule immatriculé' => 'car',
  51.             'Objets divers' => 'items',
  52.             'Téléphone GSM' => 'smartphone',
  53.         ];
  54.         return $arr;
  55.     }
  56.     /**
  57.      * Get id
  58.      *
  59.      * @return int
  60.      */
  61.     public function getId()
  62.     {
  63.         return $this->id;
  64.     }
  65.     /**
  66.      * Set brand
  67.      *
  68.      * @param string $brand
  69.      *
  70.      * @return Search
  71.      */
  72.     public function setBrand($brand)
  73.     {
  74.         $this->brand $brand;
  75.         return $this;
  76.     }
  77.     /**
  78.      * Get brand
  79.      *
  80.      * @return string
  81.      */
  82.     public function getBrand()
  83.     {
  84.         return $this->brand;
  85.     }
  86.     /**
  87.      * Set modelNumber
  88.      *
  89.      * @param string $modelNumber
  90.      *
  91.      * @return Search
  92.      */
  93.     public function setModelNumber($modelNumber)
  94.     {
  95.         $this->modelNumber $modelNumber;
  96.         return $this;
  97.     }
  98.     /**
  99.      * Get modelNumber
  100.      *
  101.      * @return string
  102.      */
  103.     public function getModelNumber()
  104.     {
  105.         return $this->modelNumber;
  106.     }
  107.     /**
  108.      * Set serialNumber
  109.      *
  110.      * @param string $serialNumber
  111.      *
  112.      * @return Search
  113.      */
  114.     public function setSerialNumber($serialNumber)
  115.     {
  116.         $this->serialNumber $serialNumber;
  117.         return $this;
  118.     }
  119.     /**
  120.      * Get serialNumber
  121.      *
  122.      * @return string
  123.      */
  124.     public function getSerialNumber()
  125.     {
  126.         return $this->serialNumber;
  127.     }
  128.     /**
  129.      * Set imeiNumber
  130.      *
  131.      * @param string $imeiNumber
  132.      *
  133.      * @return Search
  134.      */
  135.     public function setImeiNumber($imeiNumber)
  136.     {
  137.         $this->imeiNumber $imeiNumber;
  138.         return $this;
  139.     }
  140.     /**
  141.      * Get imeiNumber
  142.      *
  143.      * @return string
  144.      */
  145.     public function getImeiNumber()
  146.     {
  147.         return $this->imeiNumber;
  148.     }
  149.     /**
  150.      * Set createdAt
  151.      *
  152.      * @param \DateTime $createdAt
  153.      *
  154.      * @return Search
  155.      */
  156.     public function setCreatedAt($createdAt)
  157.     {
  158.         $this->createdAt $createdAt;
  159.         return $this;
  160.     }
  161.     /**
  162.      * Get createdAt
  163.      *
  164.      * @return \DateTime
  165.      */
  166.     public function getCreatedAt()
  167.     {
  168.         return $this->createdAt;
  169.     }
  170.     /**
  171.      * Set user
  172.      *
  173.      * @param \App\Entity\User $user
  174.      *
  175.      * @return Search
  176.      */
  177.     public function setUser(\App\Entity\User $user)
  178.     {
  179.         $this->user $user;
  180.         return $this;
  181.     }
  182.     /**
  183.      * Get user
  184.      *
  185.      * @return \App\Entity\User
  186.      */
  187.     public function getUser()
  188.     {
  189.         return $this->user;
  190.     }
  191.     /**
  192.      * Set sendNotificationToOwner
  193.      *
  194.      * @param boolean $sendNotificationToOwner
  195.      *
  196.      * @return Search
  197.      */
  198.     public function setSendNotificationToOwner($sendNotificationToOwner)
  199.     {
  200.         $this->sendNotificationToOwner $sendNotificationToOwner;
  201.         return $this;
  202.     }
  203.     /**
  204.      * Get sendNotificationToOwner
  205.      *
  206.      * @return boolean
  207.      */
  208.     public function getSendNotificationToOwner()
  209.     {
  210.         return $this->sendNotificationToOwner;
  211.     }
  212.     /**
  213.      * Set isDeleted
  214.      *
  215.      * @param boolean $isDeleted
  216.      *
  217.      * @return Search
  218.      */
  219.     public function setIsDeleted($isDeleted)
  220.     {
  221.         $this->isDeleted $isDeleted;
  222.         return $this;
  223.     }
  224.     /**
  225.      * Get isDeleted
  226.      *
  227.      * @return boolean
  228.      */
  229.     public function getIsDeleted()
  230.     {
  231.         return $this->isDeleted;
  232.     }
  233.     /**
  234.      * Set target.
  235.      *
  236.      * @param string|null $target
  237.      *
  238.      * @return Search
  239.      */
  240.     public function setTarget($target null)
  241.     {
  242.         $this->target $target;
  243.         return $this;
  244.     }
  245.     /**
  246.      * Get target.
  247.      *
  248.      * @return string|null
  249.      */
  250.     public function getTarget()
  251.     {
  252.         return $this->target;
  253.     }
  254.     /**
  255.      * Set registrationNumber.
  256.      *
  257.      * @param string|null $registrationNumber
  258.      *
  259.      * @return Search
  260.      */
  261.     public function setRegistrationNumber($registrationNumber null)
  262.     {
  263.         $this->registrationNumber $registrationNumber;
  264.         return $this;
  265.     }
  266.     /**
  267.      * Get registrationNumber.
  268.      *
  269.      * @return string|null
  270.      */
  271.     public function getRegistrationNumber()
  272.     {
  273.         return $this->registrationNumber;
  274.     }
  275. }