<?php
namespace App\Entity;
use App\Repository\VehicleRepository;
use App\Validator\VehicleUniqueRegistrationNumber;
use App\Validator\VehicleUniqueSerialNumber;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @Vich\Uploadable
*/
#[ORM\Entity(repositoryClass: VehicleRepository::class)]
#[ORM\Table(name: 'vehicle')]
#[UniqueEntity(fields: ['serial'], message: 'Ce numéro de série est déjà utilisé')]
class Vehicle implements UserObjectInterface
{
public const OTHER = 'AUTRE';
public $expressStep;
public $expressOwner;
#[ORM\OneToMany(targetEntity: "App\Entity\ComplaintX", mappedBy: "vehicle")]
private Collection|array $complaintXs;
#[ORM\OneToMany(targetEntity: "App\Entity\DisasterDeclaration", mappedBy: "vehicle", cascade: ["remove"])]
#[ORM\JoinColumn(nullable: true)]
private Collection|array $vehicle;
#[ORM\Column(name: "createdAt", type: "datetime")]
private DateTime $createdAt;
#[ORM\Column(type: "boolean")]
private bool $isDeleted = false;
#[ORM\Column(name: "id", type: "integer")]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: "AUTO")]
private ?int $id = null;
#[ORM\OneToMany(targetEntity: "App\Entity\Insurance", mappedBy: "vehicle", cascade: ["persist", "remove"])]
private Collection|array $insurances;
#[ORM\OneToMany(targetEntity: "App\Entity\ArchiveComplaint", mappedBy: "vehicle", cascade: ["persist", "remove"])]
private Collection|array $archiveComplaints;
#[ORM\OneToMany(targetEntity: "App\Entity\VehicleTheft", mappedBy: "vehicle", cascade: ["persist", "remove"])]
private Collection|array $theft;
#[ORM\OneToMany(targetEntity: "App\Entity\VehiclePhoto", mappedBy: "vehicle", cascade: ["persist", "remove"])]
private Collection|array $vehiclePhotos;
#[ORM\ManyToOne(targetEntity: "App\Entity\User", inversedBy: "vehicles")]
#[ORM\JoinColumn(nullable: false)]
private User $user;
#[Assert\Choice(callback: "getStatuts", multiple: false)]
#[ORM\Column(name: "statut", type: "string", length: 255, nullable: true)]
private string $statut = "Ok";
#[ORM\Column(type: "string", length: 255, nullable: true)]
private ?string $photosCoverId = null;
#[ORM\Column(type: "boolean")]
private bool $hasPhotosCover = false;
#[Assert\NotBlank(message: 'Ce champ est obligatoire')]
#[Assert\Choice(callback: "getTypes", multiple: false)]
#[ORM\Column(type: "string", length: 255, nullable: true)]
private ?string $type = null;
#[ORM\Column(name: "otherTypeName", type: "string", length: 255, nullable: true)]
private ?string $otherTypeName = null;
#[ORM\Column(name: "serial", type: "string", length: 255, unique: true, nullable: true)]
#[VehicleUniqueSerialNumber(
groups: ['vehicle:space']
)]
private ?string $serial = null;
#[Assert\NotBlank(message: 'Ce champ est obligatoire')]
#[ORM\Column(name: "registrationNumber", type: "string", length: 255, unique: true)]
#[VehicleUniqueRegistrationNumber(
groups: ['vehicle:space']
)]
private ?string $registrationNumber = null;
#[Assert\NotBlank(message: 'Ce champ est obligatoire')]
#[ORM\Column(name: "brand", type: "string", length: 255)]
private string $brand = '';
#[ORM\Column(name: "businessModel", type: "string", length: 255, nullable: true)]
private ?string $businessModel = null;
#[Assert\Choice(callback: "getCivilitys", multiple: false, groups: ['vehicle:space'])]
#[ORM\Column(type: "string", length: 255, nullable: true)]
private ?string $civility = null;
#[ORM\Column(name: "serialNumber", type: "string", length: 255, nullable: true)]
private string $serialNumber;
/**
* @Vich\UploadableField(mapping="vehiclePhoto", fileNameProperty="vehiclePhotoFileName", size="vehiclePhotoFileSize")
*/
private ?File $vehiclePhotoFile = null;
#[ORM\Column(type: "string", length: 255, nullable: true)]
private ?string $vehiclePhotoFileName = null;
#[ORM\Column(type: "integer", nullable: true)]
private ?int $vehiclePhotoFileSize;
#[ORM\Column(type: "datetime", nullable: true)]
private ?DateTime $vehiclePhotoFileUpdatedAt;
/**
* @Vich\UploadableField(mapping="vehicleDocumentation", fileNameProperty="vehicleDocumentationFileName", size="vehicleDocumentationFileSize")
*/
private ?File $vehicleDocumentationFile = null;
#[ORM\Column(type: "string", length: 255, nullable: true)]
private ?string $vehicleDocumentationFileName = null;
#[ORM\Column(type: "integer", nullable: true)]
private ?int $vehicleDocumentationFileSize;
#[ORM\Column(type: "datetime", nullable: true)]
private ?DateTime $vehicleDocumentationFileUpdatedAt;
#[ORM\Column(nullable: true)]
private ?bool $isRestored = null;
#[ORM\Column(nullable: true)]
private ?bool $isCompensated = null;
/**
* Constructor
*/
public function __construct()
{
$this->insurances = new ArrayCollection();
$this->vehiclePhotos = new ArrayCollection();
$this->createdAt = new DateTime();
}
public static function getStatuts()
{
$arr = [
"Ok",
"Perdu",
"Volé",
"Détruit",
"Vendu",
"Donné",
];
return array_combine($arr, $arr);
}
public static function getTypes()
{
$arr = [
"VOITURE" => "voiture",
"MOTO" => "moto",
"CAMION" => "camion",
"UTILITAIRE" => "utilitaire",
"CAMPING CAR" => "campingcar",
"CARAVANE" => "caravane",
"REMORQUE" => "remorque",
"QUAD" => "quad",
"CYCLOMOTEUR" => "cyclomoteur",
"SCOOTER" => "scooter",
];
return $arr;
}
public static function getBrands($type = null, $withOther = null): array
{
$arr = [];
if ($type == "null") {
$arr['Veuillez choisir un type'] = "0";
} else {
switch ($type) {
case 'voiture':
$arr = [
'ABARTH',
'AC',
'ACURA',
'AIXAM',
'ALFA ROMEO',
'ALKE',
'ALLARD',
'ALPINA',
'ALPINE',
'ALVIS',
'AMC',
'AMILCAR',
'ARIEL',
'ARO',
'ASHOK LEYLAND',
'ASTON MARTIN',
'AUBURN',
'AUDI',
'AUSTIN',
'AUSTIN HEALEY',
'AUTO UNION',
'AUTOBIANCHI',
'AVTOGAZ',
'AVTOVAZ',
'BELLIER',
'BENTLEY',
'BMW',
'BOLLORE',
'BUGATTI',
'BUICK',
'CADILLAC',
'CASALINI',
'CATERHAM',
'CHATENET',
'CHAUSSON',
'CHENARD ET WALCKER',
'CHEVROLET',
'CHRYSLER',
'CITROËN',
'DACIA',
'DAEWOO',
'DAIHATSU',
'DATSUN',
'DE DION-BOUTON',
'DE TOMASO',
'DELAGE',
'DELAHAYE',
'DELOREAN',
'DODGE',
'DONKERVOORT',
'DS',
'DUE',
'EXAGON',
'EXCALIBUR',
'FACEL VEGA',
'FERRARI',
'FIAT',
'FISKER',
'FORD',
'FORD MUSTANG',
'FUSO',
'GAZ',
'GINETTA',
'GMC',
'GRECAV',
'GUMPERT',
'HOMMELL',
'HONDA',
'HORCH',
'HUMMER',
'HYUNDAI',
'INFINITI',
'INNOCENTI',
'ISUZU',
'IVECO',
'JAGUAR',
'JDM SIMPA',
'JEEP',
'KIA',
'KOENIGSEGG',
'KTM',
'LADA',
'LAMBORGHINI',
'LANCIA',
'LAND ROVER',
'LEXUS',
'LIGIER',
'LINCOLN',
'LOTUS',
'MASERATI',
'MATRA',
'MAYBACH',
'MAZDA',
'MCLAREN',
'MEGA',
'MERCEDES-BENZ',
'MG',
'MIA ELECTRIC',
'MINI',
'MITSUBISHI',
'MITSUOKA',
'MORGAN',
'MORRIS',
'NASH',
'NECKAR',
'NISSAN',
'NOBLE',
'NSU',
'OLDSMOBILE',
'OPEL',
'PACKARD',
'PAGANI',
'PANHARD',
'PANOZ',
'PANTHER',
'PEUGEOT',
'PGO',
'PLYMOUTH',
'PONTIAC',
'PORSCHE',
'RADICAL',
'RENAULT',
'RILEY',
'ROLLS-ROYCE',
'ROVER',
'SAAB',
'SALEEN',
'SANTANA',
'SEAT',
'SECMA',
'SHELBY',
'SIMCA',
'SKODA',
'SMART',
'SSANGYONG',
'STUDEBAKER',
'SUBARU',
'SUZUKI',
'TALBOT',
'TAZZARI',
'TESLA MOTORS',
'TOYOTA',
'TVR',
'ULTIMA',
'VAZ',
'VECTOR',
'VENTURI',
'VOLKSWAGEN',
'VOLVO',
'WIESMANN',
'ZENVO'
];
break;
case 'moto':
$arr = [
'AGUSTA',
'APRILIA',
'BEELINE',
'BENELLI',
'BETA',
'BIMOTA',
'BLATA',
'BMW',
'BUELL',
'CAGIVA',
'CLIPIC',
'DAELIM',
'DERBI',
'DUCATI',
'FANTIC MOTOR',
'GAS-GAS',
'GENERIC',
'GIANTCO',
'GILERA',
'GOWINN',
'HARLEY-DAVIDSON',
'HONDA',
'HUSABERG',
'HUSQVARNA',
'HYOSUNG',
'ITALJET',
'KAWASAKI',
'KEEWAY',
'KREIDLER',
'KTM',
'KYMCO',
'LAMBRETTA',
'LAVERD',
'LEONART',
'LML',
'MALAGUTI',
'MBK',
'MEGELLI',
'MORINI',
'MOTO GUZZI',
'MZ',
'NORTON',
'OSSA',
'PEUGEOT',
'PGO',
'PIAGGIO',
'POLINI',
'QWIC',
'RIEJU',
'ROYAL ENFIELD',
'SCORPA',
'SHERCO',
'SKYTEAM',
'SOLEX',
'SUZUKI',
'SYM',
'TGB',
'TOMOS',
'TRIUMPH',
'VECTRIX',
'VESPA',
'VICTORY',
'YAMAHA',
'ZERO MOTORCYCLE'
];
break;
case 'camion':
$arr = [
'DAF',
'IVECO',
'KENWORTH TRUCKS',
'MAN',
'MAZ',
'MERCEDES',
'RENAULT',
'SCANIA',
'VOLVO'
];
break;
case 'utilitaire':
$arr = [
'CITROËN',
'FIAT',
'FORD',
'IVECO',
'MERCEDES',
'MITSUBISHI',
'NISSAN',
'OPEL',
'PEUGEOT',
'TOYOTA',
'VOLKSWAGEN',
'DACIA',
'DAF',
'DODGE',
'FRUEHAUF',
'FUSO',
'GENERAL TRAILER',
'GMC',
'HYUNDAI',
'ISUZU',
'KIA',
'MAN',
'MITSUBISHI',
'OPEL',
'PIAGGIO',
'RENAULT ',
'SCANIA',
'SEAT',
'STEYR PUCH',
'VOLVO'
];
break;
case 'campingcar':
$arr = [
'3C CARTIER / BRISEBRAS',
'ADRIA',
'ALCAR',
'ALPES CAMPING CAR',
'ARMORIQUE VAN',
'ATC 64',
'AUTOSTAR',
'BAJETTO',
'BAVARIA',
'BBS LOISIRS',
'BENIMAR',
'BLUCAMP',
'BRAVIA',
'BURSTNER',
'BÜRSTNER',
'CAMPEREVE',
'CAMPERVANS MONT-BLANC',
'CAMPING-CARS LIGERIENS',
'CAMPSTER',
'CARADO',
'CARTHAGO',
'CHALLENGER',
'CHAUSSON',
'CI',
'CONCEPT VAN LOISIR',
'CONCORDE',
'CREA VAN 85',
'CS REISEMOBILE',
'CUSTO VAN',
'DETHLEFFS',
'DREAMER',
'ELIOS',
'ETRUSCO',
'EURA MOBIL',
'EVASION 24',
'FLEURETTE',
'FLORIUM',
'FONT VENDOME',
'FONT VENDOME',
'FRANKIA',
'GIOTTILINE',
'GLENAN CONCEPT CARS',
'GLOBE CAMPER',
'GLOBECAR',
'HANROAD',
'HOBBY',
'HYMER',
'HYMERCAR',
'IROISE FOURGONS AMENAGES',
'ISERE EVASION',
'ITINEO',
'JCG CREATIONS',
'KARMANN-MOBIL',
'KNAUS',
'LA STRADA',
'LAIKA',
'LANDO',
'LE VOYAGEUR',
'LMC',
'LOISIRS 12',
'LUNAR',
'MAKE MY VAN',
'MALIBU',
'MC LOUIS',
'MCC',
'MERCEDES',
'MGP VEHICULES RECREATIFS',
'MOBILVETTA DESIGN',
'MORELO',
'NIESMANN + BISCHOFF',
'NOMAD ADDICT',
'NOTIN',
'OUEST CARAVANING',
'PHOENIX',
'PILOTE',
'PLA',
'PÖSSL',
'R’CAM',
'RANDGER',
'RAPIDO',
'REIMO / ECO CAMPERS',
'RIMOR',
'ROADCAR',
'ROLLER TEAM',
'SAVIGNAT-ROCHE',
'STX',
'STYLEVAN',
'SUNLIGHT',
'TECHNIC CAR 49',
'VAN LOISIRS',
'VOLKSWAGEN',
'WEINSBERG',
'WESTFALIA',
'WINGAMM'
];
break;
case 'caravane':
$arr = [
'ACE',
'AIRSTREAM',
'ALINER',
'AVENTO',
'BAILEY',
'BASOGLU',
'BIGFOOT',
'BIOD',
'BÜRSTNER',
'CARADO',
'CARAVELAIR',
'CARLIGHT',
'COACHMEN RV',
'ELDDIS',
'ERIBA',
'FENDT',
'HOBBY',
'HOMESTAR',
'HYMER',
'KABE',
'KNAUS',
'LMC ',
'RACLET',
'STERCKEMAN',
'SUBLIM',
'SUNLIGHT',
'T.E.C. CARAVANS',
'TABBERT',
'WEINSBERG'
];
break;
case 'remorque':
$arr = [
'AL-KO',
'BIG-FIC',
'BPW',
'CHEVAL LIBERTE',
'DEBON',
'DROTECH',
'DUVAL',
'ECIM',
'EDUARD',
'GKN',
'GOLIATH',
'HUMBAUR',
'IFOR WILLIAMS',
'JALON',
'KNOTT',
'LIDER',
'MAITRE SIGNALISATION',
'MECANOREM',
'NOVAL',
'PAILLARD',
'PAM',
'RADEX',
'REMCENTER',
'RTN',
'SARIS',
'SATELLITE',
'SOREL',
'SUN WAY',
'TRIGANO'
];
break;
case 'quad':
$arr = [
'ADLY',
'AEON',
'ARCTIC CAT',
'AXR',
'AXROAD',
'BAROSSA',
'BEYOND',
'BOMBARDIER',
'CAN AM',
'DINLI',
'E-TON',
'FOX',
'GAS-GAS',
'GOES',
'HONDA',
'HYTRACK',
'JIANSHE',
'KAWASAKI',
'KL',
'KYMCO',
'LIGIER',
'LINHAI',
'LONCIN',
'M FERGUSON',
'MASAI',
'MINIBIKE',
'MINICO',
'MOTORTEK',
'PGO',
'POLARIS',
'ROXON',
'SECMA',
'SMC',
'SUMO MOTOR',
'SUZUKI',
'SYM',
'TGB',
'TRITON',
'VLS',
'YAMAHA'
];
break;
case 'bateau':
$arr = [
'ACROPLAST',
'AIRON',
'AL DHAEN CRAFT',
'ALLIAURA MARINE',
'ALLURE YACHTING',
'APREAMARE',
'AQUAD',
'AQUAMAR',
'ARC-EYRE',
'ARCOA',
'ARVOR',
'ASTONDOA',
'ATLANTICO',
'ATLANTIS',
'AXIS',
'AZIMUT',
'B2 MARINE',
'BAHAMA',
'BAVARIA',
'BAYLINER',
'BEACHER',
'BENETEAU',
'BERTRAM',
'BLACK PEPPER',
'BORD A BORD',
'CHANTIER NAVAL COUACH',
'ESTOU',
'FEELING',
'GIB’SEA',
'GUYMARINE',
'JEANNEAU',
'MULTIPLAST',
'OCQUETEAU',
'PLASTIMO MARINE',
'SILLINGER',
'ZEPPELIN',
'ZODIAC'
];
break;
case 'cyclomoteur':
$arr = [
'APRILIA',
'BETA',
'DERBI',
'DIP',
'GILERA',
'HONDA',
'KEEWAY',
'KYMCO',
'MALAGUTI',
'MBK',
'PEUGEOT',
'PGO',
'PIAGGIO',
'SUZUKI',
'SYM',
'YAMAHA'
];
break;
case 'scooter':
$arr = [
'APRILIA',
'BENELLI',
'CPI',
'DERBI',
'GILERA',
'HONDA',
'KYMCO',
'MALAGUTI',
'MBK',
'PEUGEOT',
'PIAGGIO',
'SUZUKI',
'SYM',
'YAMAHA'
];
break;
}
}
if ($withOther) {
$arr = array_merge($arr, [
$withOther,
]);
}
$arr = array_combine($arr, $arr);
asort($arr);
return count($arr) > 0 ? array_merge($arr, [
self::OTHER => self::OTHER,
]) : $arr;
}
public static function getBrandsForSearch(): array
{
$arr = [
'ABARTH',
'ADRIA',
'AGUSTA',
'AIRSTREAM',
'AIXAM',
'ALFA ROMEO',
'ALPINA',
'ALPINE',
'APRILIA',
'ARCTIC CAT',
'ASTON MARTIN',
'AUDI',
'AUSTIN',
'AUSTIN HEALEY',
'AUTOBIANCHI',
'AUTOSTAR',
'BAVARIA',
'BENELLI',
'BENTLEY',
'BIMOTA',
'BMW',
'BOLLORE',
'BOMBARDIER',
'BUGATTI',
'BUICK',
'CADILLAC',
'CAGIVA',
'CARAVELAIR',
'CATERHAM',
'CHALLENGER',
'CHAUSSON',
'CHEVROLET',
'CHRYSLER',
'CITROËN',
'DACIA',
'DAEWOO',
'DAF',
'DAIHATSU',
'DATSUN',
'DERBI',
'DODGE',
'DS',
'DUCATI',
'FANTIC MOTOR',
'FERRARI',
'FIAT',
'FORD',
'FRUEHAUF',
'GILERA',
'GINETTA',
'GMC',
'HARLEY-DAVIDSON',
'HONDA',
'HUMMER',
'HUSQVARNA',
'HYMER',
'HYUNDAI',
'INFINITI',
'INNOCENTI',
'ISUZU',
'IVECO',
'JAGUAR',
'JEEP',
'KARMANN-MOBIL',
'KAWASAKI',
'KENWORTH TRUCKS',
'KIA',
'KTM',
'KYMCO',
'LADA',
'LAMBORGHINI',
'LAMBRETTA',
'LANCIA',
'LAND ROVER',
'LAVERDA',
'LEXUS',
'LIGIER',
'LOTUS',
'MALAGUTI',
'MAN',
'MASERATI',
'MATRA',
'MAYBACH',
'MAZDA',
'MBK',
'MCLAREN',
'MECANOREM',
'MERCEDES',
'MERCEDES-BENZ',
'MG',
'MINI',
'MITSUBISHI',
'MORGAN',
'MORINI',
'MORRIS',
'MOTO GUZZI',
'MZ',
'NISSAN',
'NORTON',
'NOVAL',
'OLDSMOBILE',
'OPEL',
'OSSA',
'PANHARD',
'PEUGEOT',
'PGO',
'PHOENIX',
'PIAGGIO',
'PILOTE',
'PLYMOUTH',
'POLARIS',
'PONTIAC',
'PORSCHE',
'RAPIDO',
'RENAULT',
'ROLLS-ROYCE',
'ROVER',
'ROYAL ENFIELD',
'SAAB',
'SANTANA',
'SATELLITE',
'SCANIA',
'SEAT',
'SIMCA',
'SKODA',
'SMART',
'SOLEX',
'STERCKEMAN',
'SUBARU',
'SUZUKI',
'TALBOT',
'TESLA MOTORS',
'TOYOTA',
'TRIGANO',
'TRIUMPH',
'TVR',
'VESPA',
'VOLKSWAGEN',
'VOLVO',
'WEINSBERG',
'WESTFALIA',
'YAMAHA'
];
return array_combine($arr, $arr);
}
public static function getCivilitys(?string $civility = null)
{
$arr = [
"Moi uniquement" => "mine",
"Moi et mon époux(se)" => "both",
"Moi et une autre personne" => "other",
"Moi et plusieurs personnes" => "others",
"Moi et une société de financement" => "financialCompany",
];
return $arr;
}
/**
* Get vehiclePhotosCover.
*
* @return string|null
*/
public function getPhotosCoverId()
{
return $this->photosCoverId;
}
/**
* Set photosCoverId.
*
* @param string|null $photosCoverId
*
* @return Vehicle
*/
public function setPhotosCoverId($photosCoverId = null)
{
$this->photosCoverId = $photosCoverId;
return $this;
}
/**
* Get hasPhotosCover
*
* @return boolean
*/
public function getHasPhotosCover()
{
return $this->hasPhotosCover;
}
/**
* Set hasPhotosCover
*
* @param boolean $hasPhotosCover
*
* @return Vehicle
*/
public function setHasPhotosCover($hasPhotosCover)
{
$this->hasPhotosCover = $hasPhotosCover;
return $this;
}
public function __toString()
{
return "#" . $this->id . " - " . $this->createdAt->format("d/m/Y H:i");
}
public function getVehicleDocumentationFile()
{
return $this->vehicleDocumentationFile;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|UploadedFile $image
*/
public function setVehicleDocumentationFile(File $image = null)
{
$this->vehicleDocumentationFile = $image;
if (null !== $image) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->vehicleDocumentationFileUpdatedAt = new DateTime();
}
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set type
*
* @param string $type
*
* @return Vehicle
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get registrationNumber
*
* @return string
*/
public function getRegistrationNumber()
{
return $this->registrationNumber;
}
/**
* Set registrationNumber
*
* @param string $registrationNumber
*
* @return Vehicle
*/
public function setRegistrationNumber($registrationNumber)
{
$this->registrationNumber = $registrationNumber;
return $this;
}
/**
* Get brand
*
* @return string
*/
public function getBrand()
{
return $this->brand;
}
/**
* Set brand
*
* @param string $brand
*
* @return Vehicle
*/
public function setBrand($brand)
{
$this->brand = $brand;
return $this;
}
/**
* Get businessModel
*
* @return string
*/
public function getBusinessModel()
{
return $this->businessModel;
}
/**
* Set businessModel
*
* @param string $businessModel
*
* @return Vehicle
*/
public function setBusinessModel($businessModel)
{
$this->businessModel = $businessModel;
return $this;
}
/**
* Get serialNumber
*
* @return string
*/
public function getSerialNumber()
{
return $this->serialNumber;
}
/**
* Set serialNumber
*
* @param string $serialNumber
*
* @return Vehicle
*/
public function setSerialNumber($serialNumber)
{
$this->serialNumber = $serialNumber;
return $this;
}
/**
* Add vehiclePhoto
*
* @param VehiclePhoto $vehiclePhoto
*
* @return Vehicle
*/
public function addVehiclePhoto(VehiclePhoto $vehiclePhoto)
{
$this->vehiclePhotos[] = $vehiclePhoto;
$vehiclePhoto->setVehicle($this);
return $this;
}
/**
* Remove vehiclePhoto
*
* @param VehiclePhoto $vehiclePhoto
*/
public function removeVehiclePhoto(VehiclePhoto $vehiclePhoto)
{
$this->vehiclePhotos->removeElement($vehiclePhoto);
}
/**
* Get vehiclePhotos
*
* @return Collection
*/
public function getVehiclePhotos()
{
return $this->vehiclePhotos;
}
/**
* Get user
*
* @return User|null
*/
public function getUser(): ?User
{
return $this->user;
}
/**
* Set user
*
* @param User $user
*
* @return Vehicle
*/
public function setUser(User $user)
{
$this->user = $user;
return $this;
}
/**
* Get vehicleDocumentationFileName
*
* @return string
*/
public function getVehicleDocumentationFileName()
{
return $this->vehicleDocumentationFileName;
}
/**
* Set vehicleDocumentationFileName
*
* @param string $vehicleDocumentationFileName
*
* @return Vehicle
*/
public function setVehicleDocumentationFileName($vehicleDocumentationFileName)
{
$this->vehicleDocumentationFileName = $vehicleDocumentationFileName;
return $this;
}
/**
* Get vehicleDocumentationFileSize
*
* @return integer
*/
public function getVehicleDocumentationFileSize()
{
return $this->vehicleDocumentationFileSize;
}
/**
* Set vehicleDocumentationFileSize
*
* @param integer $vehicleDocumentationFileSize
*
* @return Vehicle
*/
public function setVehicleDocumentationFileSize($vehicleDocumentationFileSize)
{
$this->vehicleDocumentationFileSize = $vehicleDocumentationFileSize;
return $this;
}
/**
* Get vehicleDocumentationFileUpdatedAt
*
* @return DateTime
*/
public function getVehicleDocumentationFileUpdatedAt()
{
return $this->vehicleDocumentationFileUpdatedAt;
}
/**
* Set vehicleDocumentationFileUpdatedAt
*
* @param DateTime $vehicleDocumentationFileUpdatedAt
*
* @return Vehicle
*/
public function setVehicleDocumentationFileUpdatedAt($vehicleDocumentationFileUpdatedAt)
{
$this->vehicleDocumentationFileUpdatedAt = $vehicleDocumentationFileUpdatedAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
*
* @return Vehicle
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get isDeleted
*
* @return boolean
*/
public function getIsDeleted()
{
return $this->isDeleted;
}
/**
* Set isDeleted
*
* @param boolean $isDeleted
*
* @return Vehicle
*/
public function setIsDeleted($isDeleted)
{
$this->isDeleted = $isDeleted;
return $this;
}
/**
* Add complaintX
*
* @param ComplaintX $complaintX
*
* @return Vehicle
*/
public function addComplaintX(ComplaintX $complaintX)
{
$this->complaintXs[] = $complaintX;
return $this;
}
/**
* Remove complaintX
*
* @param ComplaintX $complaintX
*/
public function removeComplaintX(ComplaintX $complaintX)
{
$this->complaintXs->removeElement($complaintX);
}
/**
* Get complaintXs
*
* @return Collection
*/
public function getComplaintXs()
{
return $this->complaintXs;
}
/**
* Get civility
*
* @return string
*/
public function getCivility()
{
return $this->civility;
}
/**
* Set civility
*
* @param string $civility
*
* @return Vehicle
*/
public function setCivility($civility)
{
// $civility = match ($civility) {
// 'partner' => 'both',
// 'loan' => 'other',
// 'rent' => 'other',
// 'work' => 'other',
// 'service' => 'other',
// 'loancomp' => 'other',
// default => $civility,
// };
$this->civility = $civility;
return $this;
}
/**
* Add insurance
*
* @param Insurance $insurance
*
* @return Vehicle
*/
public function addInsurance(Insurance $insurance)
{
$this->insurances[] = $insurance;
return $this;
}
/**
* Remove insurance
*
* @param Insurance $insurance
*/
public function removeInsurance(Insurance $insurance)
{
$this->insurances->removeElement($insurance);
}
/**
* Get insurances
*
* @return Collection
*/
public function getInsurances()
{
return $this->insurances;
}
/**
* Get otherTypeName.
*
* @return string
*/
public function getOtherTypeName()
{
return $this->otherTypeName;
}
/**
* Set otherTypeName.
*
* @param string $otherTypeName
*
* @return Vehicle
*/
public function setOtherTypeName($otherTypeName)
{
$this->otherTypeName = $otherTypeName;
return $this;
}
/**
* Get serial.
*
* @return string
*/
public function getSerial()
{
return $this->serial;
}
/**
* Set serial.
*
* @param string $serial
*
* @return Vehicle
*/
public function setSerial($serial)
{
$this->serial = $serial;
return $this;
}
/**
* Add vehicle.
*
* @param DisasterDeclaration $vehicle
*
* @return Vehicle
*/
public function addVehicle(DisasterDeclaration $vehicle)
{
$this->vehicle[] = $vehicle;
return $this;
}
/**
* Remove vehicle.
*
* @param DisasterDeclaration $vehicle
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeVehicle(DisasterDeclaration $vehicle)
{
return $this->vehicle->removeElement($vehicle);
}
/**
* Get vehicle.
*
* @return Collection
*/
public function getVehicle()
{
return $this->vehicle;
}
/**
* Add theft.
*
* @param VehicleTheft $theft
*
* @return Vehicle
*/
public function addTheft(VehicleTheft $theft)
{
$this->theft[] = $theft;
return $this;
}
/**
* Remove theft.
*
* @param VehicleTheft $theft
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeTheft(VehicleTheft $theft)
{
return $this->theft->removeElement($theft);
}
/**
* Get theft.
*
* @return Collection
*/
public function getTheft()
{
return $this->theft;
}
/**
* Add archiveComplaint.
*
* @param ArchiveComplaint $archiveComplaint
*
* @return Vehicle
*/
public function addArchiveComplaint(ArchiveComplaint $archiveComplaint)
{
$this->archiveComplaints[] = $archiveComplaint;
return $this;
}
/**
* Remove archiveComplaint.
*
* @param ArchiveComplaint $archiveComplaint
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeArchiveComplaint(ArchiveComplaint $archiveComplaint)
{
return $this->archiveComplaints->removeElement($archiveComplaint);
}
/**
* Get archiveComplaints.
*
* @return Collection
*/
public function getArchiveComplaints()
{
return $this->archiveComplaints;
}
/**
* Get statut.
*
* @return string|null
*/
public function getStatut()
{
return $this->statut;
}
/**
* Set statut.
*
* @param string|null $statut
*
* @return Vehicle
*/
public function setStatut($statut = null)
{
$this->statut = $statut;
return $this;
}
public function isIsRestored(): ?bool
{
return $this->isRestored;
}
public function setIsRestored(?bool $isRestored): static
{
$this->isRestored = $isRestored;
return $this;
}
public function isIsCompensated(): ?bool
{
return $this->isCompensated;
}
public function setIsCompensated(?bool $isCompensated): static
{
$this->isCompensated = $isCompensated;
return $this;
}
public function getActiveInsurance(): ?Insurance
{
$insurance = $this->insurances->filter(fn(Insurance $insurance) => !$insurance->getIsDeleted())->first();
return !$insurance ? null : $insurance;
}
public function hasActiveInsurance(): bool
{
return $this->getActiveInsurance() !== null;
}
public function getVehiclePhotoFile()
{
return $this->vehiclePhotoFile;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|UploadedFile $image
*/
public function setVehiclePhotoFile(File $image = null)
{
$this->vehiclePhotoFile = $image;
if (null !== $image) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->vehiclePhotoFileUpdatedAt = new DateTime();
}
}
/**
* Get vehiclePhotoFileName
*
* @return string
*/
public function getVehiclePhotoFileName()
{
return $this->vehiclePhotoFileName;
}
/**
* Set vehiclePhotoFileName
*
* @param string $vehiclePhotoFileName
*
* @return Vehicle
*/
public function setVehiclePhotoFileName($vehiclePhotoFileName)
{
$this->vehiclePhotoFileName = $vehiclePhotoFileName;
return $this;
}
/**
* Get vehiclePhotoFileSize
*
* @return integer
*/
public function getVehiclePhotoFileSize()
{
return $this->vehiclePhotoFileSize;
}
/**
* Set vehiclePhotoFileSize
*
* @param integer $vehiclePhotoFileSize
*
* @return Vehicle
*/
public function setVehiclePhotoFileSize($vehiclePhotoFileSize)
{
$this->vehiclePhotoFileSize = $vehiclePhotoFileSize;
return $this;
}
/**
* Get vehiclePhotoFileUpdatedAt
*
* @return DateTime
*/
public function getVehiclePhotoFileUpdatedAt()
{
return $this->vehiclePhotoFileUpdatedAt;
}
/**
* Set vehiclePhotoFileUpdatedAt
*
* @param DateTime $vehiclePhotoFileUpdatedAt
*
* @return Vehicle
*/
public function setVehiclePhotoFileUpdatedAt($vehiclePhotoFileUpdatedAt)
{
$this->vehiclePhotoFileUpdatedAt = $vehiclePhotoFileUpdatedAt;
return $this;
}
}