<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: "App\Repository\SearchRepository")]
#[ORM\Table(name: "search")]
class Search
{
#[ORM\Column(type: "string", length: 255, nullable: true)]
private ?string $target = null;
#[ORM\Column(name: "createdAt", type: "datetime")]
private DateTime $createdAt;
#[ORM\Column(type: "boolean")]
private bool $isDeleted = false;
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: "searchs")]
#[ORM\JoinColumn(nullable: false)]
private User $user;
#[ORM\Column(type: "integer")]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: "AUTO")]
private ?int $id;
#[ORM\Column(name: "brand", type: "string", length: 255, nullable: true)]
#[Assert\NotBlank(message: 'Ce champ est obligatoire')]
private ?string $brand = null;
#[ORM\Column(type: "boolean")]
private bool $sendNotificationToOwner = false;
#[ORM\Column(name: "modelNumber", type: "string", length: 255, nullable: true)]
private ?string $modelNumber = null;
#[ORM\Column(name: "serialNumber", type: "string", length: 255, nullable: true)]
private ?string $serialNumber = null;
#[ORM\Column(name: "registrationNumber", type: "string", length: 255, nullable: true)]
private ?string $registrationNumber = null;
#[ORM\Column(name: "imeiNumber", type: "string", length: 255, nullable: true)]
private ?string $imeiNumber = null;
public function __construct()
{
$this->createdAt = new DateTime();
}
public function __toString()
{
return "#" . $this->id . " - " . $this->createdAt->format("d/m/Y H:i");
}
/**
*
*/
public static function getTargets()
{
$arr = [
'Véhicule immatriculé' => 'car',
'Objets divers' => 'items',
'Téléphone GSM' => 'smartphone',
];
return $arr;
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set brand
*
* @param string $brand
*
* @return Search
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set modelNumber
*
* @param string $modelNumber
*
* @return Search
*/
public function setModelNumber($modelNumber)
{
$this->modelNumber = $modelNumber;
return $this;
}
/**
* Get modelNumber
*
* @return string
*/
public function getModelNumber()
{
return $this->modelNumber;
}
/**
* Set serialNumber
*
* @param string $serialNumber
*
* @return Search
*/
public function setSerialNumber($serialNumber)
{
$this->serialNumber = $serialNumber;
return $this;
}
/**
* Get serialNumber
*
* @return string
*/
public function getSerialNumber()
{
return $this->serialNumber;
}
/**
* Set imeiNumber
*
* @param string $imeiNumber
*
* @return Search
*/
public function setImeiNumber($imeiNumber)
{
$this->imeiNumber = $imeiNumber;
return $this;
}
/**
* Get imeiNumber
*
* @return string
*/
public function getImeiNumber()
{
return $this->imeiNumber;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return Search
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set user
*
* @param \App\Entity\User $user
*
* @return Search
*/
public function setUser(\App\Entity\User $user)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \App\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set sendNotificationToOwner
*
* @param boolean $sendNotificationToOwner
*
* @return Search
*/
public function setSendNotificationToOwner($sendNotificationToOwner)
{
$this->sendNotificationToOwner = $sendNotificationToOwner;
return $this;
}
/**
* Get sendNotificationToOwner
*
* @return boolean
*/
public function getSendNotificationToOwner()
{
return $this->sendNotificationToOwner;
}
/**
* Set isDeleted
*
* @param boolean $isDeleted
*
* @return Search
*/
public function setIsDeleted($isDeleted)
{
$this->isDeleted = $isDeleted;
return $this;
}
/**
* Get isDeleted
*
* @return boolean
*/
public function getIsDeleted()
{
return $this->isDeleted;
}
/**
* Set target.
*
* @param string|null $target
*
* @return Search
*/
public function setTarget($target = null)
{
$this->target = $target;
return $this;
}
/**
* Get target.
*
* @return string|null
*/
public function getTarget()
{
return $this->target;
}
/**
* Set registrationNumber.
*
* @param string|null $registrationNumber
*
* @return Search
*/
public function setRegistrationNumber($registrationNumber = null)
{
$this->registrationNumber = $registrationNumber;
return $this;
}
/**
* Get registrationNumber.
*
* @return string|null
*/
public function getRegistrationNumber()
{
return $this->registrationNumber;
}
}