<?php
/*
* This file is part of the VPAutoDeclareSaleBundle package.
*
* (c) CNSX <http://www.cnsx.net/>
*
*/
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\EntityNotFoundException;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Sluggable\Util\Urlizer;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\VehicleRepository")
*
* @ORM\InheritanceType("JOINED")
*
* @ORM\DiscriminatorColumn(name="discr", type="string")
*
* @ORM\DiscriminatorMap({"vehicle" = "Vehicle", "external_vehicle" = "ExternalVehicle"})
*
* @ORM\Table(
* name="vehicle",
* indexes={
*
* @ORM\Index(columns={"etincelleId"}),
* @ORM\Index(columns={"salingState"}),
* @ORM\Index(columns={"lot"}),
* @ORM\Index(columns={"maker"}),
* @ORM\Index(columns={"modelGroup"})
* }
* )
*
* @ORM\HasLifecycleCallbacks
*/
class Vehicle
{
public const SALING_STATE_NONE = 'NC';
public const SALING_STATE_CURRENT = 'En cours';
public const SALING_STATE_RETIRE = 'Retiré';
public const SALING_STATE_ADJUGE = 'Adjugé';
public const SALING_STATE_EXCLUS = 'Exclus';
public const SALING_STATE_SUPPRIME = 'Supprimé';
public const SALING_STATE_NO_STARTING_PRICE = 'Absence mise à prix';
public const TARIFICATION_TYPE_VOLUNTARY = 'Volontaire';
public const TARIFICATION_TYPE_COMPULSORY = 'Judiciaire';
public const SELLER_STATE_WAITING_CALLBACK = 'Attente vendeur';
public const SELLER_STATE_WAITING_SALESMAN = 'Attente commercial';
public const SELLER_STATE_CLOSE = 'Clôturé';
public const PHOTOS_PUBLIC = 'public';
public const PHOTOS_EXPERTISE = 'expertise';
public const IDENTIFICATION_TYPE_CARD = 'CG';
public const IDENTIFICATION_TYPE_SHEET = 'ID';
public const IDENTIFICATION_TYPE_DUPLICATE = 'DUP';
public const SELLER_NOT_ELIGIBLE_POST_SALE = ['SINEQUAE'];
public const PAGER_MAX = 96;
public const RESULTS_MAX = 48;
public const MAX_ANIMATION_PERCENT = 5;
public static $freeSearchItems = ['v.class', 'v.maker', 'v.model', 'vc.name', 'o.name'];
/**
* @ORM\Id
*
* @ORM\Column(type="string")
*
* @ORM\GeneratedValue(strategy="NONE")
*
* @Groups({"read"})
*/
protected $id;
/**
* @ORM\Column(type="string")
*
* @Groups({"read"})
*/
protected $vehicleId;
/**
* Locale.
*
* @Gedmo\Locale
*/
protected $locale;
/**
* @ORM\OneToMany(targetEntity="App\Entity\VehicleAlert", mappedBy="vehicle", cascade={"remove"})
**/
protected $usersToAlert;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Selection", mappedBy="vehicle", cascade={"remove"})
**/
protected $selections;
/**
* @ORM\OneToMany(targetEntity="App\Entity\SmsAlert", mappedBy="vehicle", cascade={"remove"})
**/
protected $smsAlerts;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\SaleEvent", inversedBy="vehicles",fetch="EAGER", cascade={"persist"})
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read"})
*/
protected $event;
/**
* @var Auction
*
* @ORM\OneToOne(targetEntity="App\Entity\Auction", mappedBy="vehicle", cascade={"persist", "remove"})
*/
protected $auction;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PurchaseInstruction", mappedBy="vehicle", cascade={"remove"})
*
* @ORM\OrderBy({"amount" = "desc", "updatedAt" = "asc"})
*/
protected $purchaseInstructions;
/**
* @ORM\Column(type="array", nullable=true)
*
* @Groups({"read"})
**/
protected $photos;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Option", cascade={"persist"})
*
* @ORM\JoinTable(name="vehicle_option")
*
* @ORM\OrderBy({"weight" = "asc"})
*
* @Groups({"read"})
*/
protected $options;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Groups({"read"})
*/
protected $lot;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $lotComplement;
/**
* @ORM\Column(type="boolean", name="isranked")
*/
protected $ordered;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
**/
protected $salingState = self::SALING_STATE_NONE;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User")
*
* @ORM\JoinColumn(name="winner_id", referencedColumnName="id")
*/
protected $winner;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $class;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
*/
protected $maker;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*/
protected $makerSlug;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
*/
protected $modelGroup;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*/
protected $modelGroupSlug;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*/
protected $segment;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*/
protected $segmentSlug;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*/
protected $segmentSize;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*/
protected $segmentSizeSlug;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
*/
protected $segmentBody;
/**
* @var Transmission
*
* @ORM\ManyToOne(targetEntity="App\Entity\Transmission", cascade={"persist"})
*
* @ORM\JoinColumn(name="transmission_id", referencedColumnName="id", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
*/
protected $segmentTransmission;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Category", cascade={"persist"})
*
* @ORM\JoinColumn(name="category_id", referencedColumnName="id")
*
* @Groups({"read"})
*/
protected $category;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $model;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
**/
protected $typeCode;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $millesime;
/**
* @ORM\Column(type="date", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $registrationDate;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $kilometers;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $taxHorsepower;
/**
* @var Energy
*
* @ORM\ManyToOne(targetEntity="App\Entity\Energy", cascade={"persist"})
*
* @ORM\JoinColumn(name="energy_id", referencedColumnName="id", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
*/
protected $energy;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
**/
protected $bodyType;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $stateDetails;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $guarantee;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $guaranteed;
/**
* @ORM\Column(type="decimal", scale=1, nullable=true)
**/
protected $stateRating;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $afnor;
/**
* @ORM\Column(type="integer")
*/
protected $etincelleId;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $iridiumId;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $vat;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $seatCount;
/**
* @ORM\Column(type="text", nullable=true)
*
* @Gedmo\Translatable
**/
protected $observation;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $motFileUrl;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $maintenanceFileUrl;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $roadTestFileUrl;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $bilanExpertFileUrl;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $photo3dExteriorUrl;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $photo3dExteriorExtraUrl;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $explodedViewFileUrl;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $dekraUrl;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $inspectionReportUrl;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $argusPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $argusTransactionPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $argusAnnoncePrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $argusDatedPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $argusKmPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $spotPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $reconditioningPrice;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
**/
protected $estimationPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $estimationPriceMin;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $initialReservePrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $initialReservePriceHF;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
**/
protected $reservePrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $reservePriceHF;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $oldReservePrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $oldReservePriceHF;
/**
* @ORM\Column(type="integer")
*/
protected $deltaReservePrice = 0;
/**
* @ORM\Column(type="integer")
*/
protected $deltaFees = 0;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $unusedPrice;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
**/
protected $startingPrice;
/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $buyoutPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $unsoldPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $unsoldOnlinePrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $lastHammerPrice;
/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $finalAmount;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $unsoldCount;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $unsoldOnlineCount;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
**/
protected $broken;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $duplicateKeys;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Groups({"read"})
**/
protected $co2;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
**/
protected $euroEmissionStandard;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $shortModel;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $version;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Groups({"read"})
**/
protected $length;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Groups({"read"})
**/
protected $width;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Groups({"read"})
**/
protected $height;
/**
* @ORM\Column(type="string")
*/
protected $tarification;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $tarificationType;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $zipCodeLocation;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $cityLocation;
/**
* @ORM\Column(type="boolean")
**/
protected $lotOpen = false;
/**
* @ORM\Column(type="boolean")
*/
protected $justOpened = false;
/**
* @ORM\Column(type="integer")
*/
protected $nbViews = 0;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $noShipping;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $salesperson;
/**
* @ORM\Column(type="date", nullable=true)
**/
protected $etincelleCreatedAt;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $etincelleSalingState;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $etincelleSalingStateComplement;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $urgent;
/**
* @ORM\Column(type="date", nullable=true)
**/
protected $mandateDate;
/**
* @ORM\Column(type="date", nullable=true)
**/
protected $soldDate;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
**/
protected $registrationPlate;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $adjustable;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Groups({"read"})
**/
protected $emptyWeight;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $liftingCapacity;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $liftingHeight;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $engineActualHourCount;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $wheelBase;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $cylinderCount;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $doorCount;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $gearCount;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
**/
protected $driveWheel;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $loadWeight;
/**
* @ORM\Column(type="integer", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*
* @Groups({"read"})
**/
protected $horsePower;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
**/
protected $gearbox;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $maintenanceBookState;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $maintenanceFileState;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $makerGuarantee;
/**
* @ORM\Column(type="date", nullable=true)
**/
protected $makerGuaranteeExpiredAt;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $makerGuaranteeKilometers;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $premiumGuarantee;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $premiumGuaranteeDescription;
/**
* @ORM\Column(type="string", length=1, nullable=true)
**/
protected $segmentFirst;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $firstHand;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $argusOID;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Groups({"read"})
**/
protected $natCode;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $damaged;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $sellerObservation;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $trainingVehicle;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $taxi;
/**
* @ORM\Column(type="boolean", nullable=true)
**/
protected $mechanicallyDamaged;
/**
* @ORM\Column(type="decimal", scale=1, nullable=true)
**/
protected $innerStateRating;
/**
* @ORM\Column(type="decimal", scale=1, nullable=true)
**/
protected $expertiseRating;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $highlight;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $catalog;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $catalogHighlight;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $star;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $starElectro = false;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Seller", inversedBy="vehicles", cascade={"persist"})
*
* @ORM\JoinColumn(name="seller_id", referencedColumnName="id")
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*/
protected $seller;
/**
* @ORM\OneToMany(targetEntity="App\Entity\VehicleBehaviour", mappedBy="vehicle", cascade={"remove"})
*/
protected $behaviours;
/**
* @ORM\Column(type="string", nullable=true)
*/
protected $sellerCallback = self::SELLER_STATE_WAITING_CALLBACK;
/**
* @ORM\Column(type="boolean")
*/
protected $sentToSap = false;
/**
* @ORM\Column(type="string", length=5, nullable=true)
*
* @Groups({"read"})
*/
protected $critair;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $deliveryRequest;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $identificationType;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $etincelleReservePrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $sellerEstimationPrice;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $etincelleReservePriceHF;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $sellerEstimationPriceHF;
/**
* @ORM\Column(type="integer", nullable=true)
**/
protected $estimationPriceHF;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $cocFileUrl;
/**
* @ORM\Column(type="text", nullable=true)
**/
protected $carpassFileUrl;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $firstCountryRegistration;
/**
* @ORM\Column(type="string", nullable=true)
**/
protected $co2Standard;
/**
* @ORM\Column(type="string", nullable=true)
*
* @Assert\NotBlank(groups={"api_iridium_vehicle"})
*/
private $vin;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Color", cascade={"persist"})
*
* @ORM\JoinColumn(name="color_id", referencedColumnName="id", nullable=true)
*/
private $color;
/**
* @ORM\Column(type="string", nullable=true)
**/
private $dataHubUUID;
/**
* @ORM\Column(type="string", nullable=true)
**/
private $sapFile;
public function __construct()
{
$this->usersToAlert = new ArrayCollection();
$this->selections = new ArrayCollection();
$this->purchaseInstructions = new ArrayCollection();
$this->options = new ArrayCollection();
$this->behaviours = new ArrayCollection();
$this->ordered = false;
$this->deliveryRequest = false;
}
/**
* Set slugs.
*
* @ORM\PrePersist()
*
* @ORM\PreUpdate()
*/
public function initSlugs(): void
{
$this->makerSlug = $this->maker ? Urlizer::urlize($this->maker) : null;
$this->modelGroupSlug = $this->modelGroup ? Urlizer::urlize($this->modelGroup) : null;
$this->segmentSlug = $this->segment ? Urlizer::urlize($this->segment) : null;
$this->segmentSizeSlug = $this->segmentSize ? Urlizer::urlize($this->segmentSize) : null;
}
public function getId()
{
return $this->id;
}
public function setId($id): void
{
$this->id = $id;
}
public function getVehicleId()
{
return $this->vehicleId;
}
public function setVehicleId($vehicleId): void
{
$this->vehicleId = $vehicleId;
}
public function getLocale()
{
return $this->locale;
}
public function setLocale($locale): void
{
$this->locale = $locale;
}
public function setAlerts(ArrayCollection $alerts): void
{
$this->usersToAlert = $alerts;
}
public function getAlerts()
{
return $this->usersToAlert;
}
public function setSelections(ArrayCollection $selections): void
{
$this->selections = $selections;
}
public function getSelections()
{
return $this->selections;
}
public function removeSelection(Selection $selection)
{
return $this->selections->removeElement($selection);
}
public function setSmsAlerts(ArrayCollection $smsAlerts): void
{
$this->smsAlerts = $smsAlerts;
}
public function getSmsAlerts()
{
return $this->smsAlerts;
}
public function removeSmsAlert(SmsAlert $smsAlert)
{
return $this->smsAlerts->removeElement($smsAlert);
}
public function setEvent(SaleEvent $event): void
{
$this->event = $event;
}
public function getEvent()
{
return $this->event;
}
public function getSale(): ?Sale
{
try {
return $this->event->getSale();
} catch (EntityNotFoundException) {
return null;
}
}
public function getAuction()
{
return $this->auction;
}
public function setAuction(Auction $auction): void
{
$this->auction = $auction;
}
public function getAuctionOpen(?\DateTime $at = null, $delay = 0)
{
if (null === $this->auction) {
return false;
}
$at = $at ? $at->format('U') : (time() * 1000);
if (null === $this->auction->getClosedAt()) {
return false;
}
if (true === $this->auction->isPaused()) {
return true;
}
return (($this->auction->getClosedAt()->format('U') * 1000) + $this->auction->getPausedMs() + $delay * 1000) > (time() * 1000);
}
public function isAuctionOpen(?\DateTime $at = null)
{
return (bool) $this->getAuctionOpen($at, 2);
}
public function setAuctionOpen($open, $startSecond = 15, $auctionSecond = 10)
{
if ($open) {
if ($this->justOpened) {
$second = false !== $startSecond ?
$startSecond :
$auctionSecond;
} else {
$second = $auctionSecond;
}
if (null === $this->auction->getOpenedAt() || !$this->isAuctionOpen()) {
$this->auction->setOpenedAt(new \DateTime());
}
$dt = new \DateTime();
$dt->modify(sprintf('+%d second', $second));
$this->auction->setClosedAt($dt);
$this->justOpened = false;
} else {
$this->auction->setOpenedAt(null);
$this->auction->setClosedAt(null);
$this->justOpened = false;
}
return $this;
}
public function getPurchaseInstructions()
{
$purchaseInstructions = [];
// Take only the current purchase instructions, not for every sale
foreach ($this->purchaseInstructions as $instruction) {
if ($instruction->getSale()->getId() == $this->getSale()->getId()) {
$purchaseInstructions[] = $instruction;
}
}
return $purchaseInstructions;
}
/**
* Reindex the array to avoid issues when reading the pis.
*
* @see \App\Controller\Frontend\PurchaseInstructionController::boxAction
*/
public function getValidPurchaseInstructions()
{
$purchaseInstructions = array_filter(
$this->purchaseInstructions->toArray(),
fn ($pi) => PurchaseInstruction::ACCEPTED === $pi->getStatus() || PurchaseInstruction::WON === $pi->getStatus()
);
return array_values($purchaseInstructions);
}
public function getAllPurchaseInstructions()
{
return $this->purchaseInstructions;
}
public function getHighestPurchaseInstruction()
{
$pis = $this->getValidPurchaseInstructions();
if (!is_array($pis) || count($pis) <= 0) {
return null;
}
return $pis[0];
}
public function getPurchaseInstructionAfterSale()
{
$purchaseInstructions = array_filter(
$this->purchaseInstructions->toArray(),
fn ($pi) => PurchaseInstruction::ACCEPTED === $pi->getStatus() && $pi->getSale()->getId() == $this->getSale()->getId() && $this->auction->getClosedAt() < $pi->getUpdatedAt()
);
return array_values($purchaseInstructions);
}
public function getHighestPurchaseInstructionAfterSale()
{
$pis = $this->getPurchaseInstructionAfterSale();
if (!is_array($pis) || count($pis) <= 0) {
return null;
}
return $pis[0];
}
public function setPurchaseInstructions(Collection $purchaseInstructions): void
{
$this->purchaseInstructions = $purchaseInstructions;
}
public function setPhotos($photos): void
{
$this->photos = $photos;
}
public function getPhotos()
{
return $this->photos;
}
public function getPublicPhotos()
{
return $this->photos[self::PHOTOS_PUBLIC] ?? null;
}
public function getExpertisePhotos()
{
return $this->photos[self::PHOTOS_EXPERTISE] ?? null;
}
public function addOption(Option $option): void
{
if (!$this->options->contains($option)) {
$this->options[] = $option;
}
}
public function getOptions()
{
return $this->options;
}
public function setOptions($options): void
{
$this->options = $options;
}
public function clearOptions(): void
{
$this->options->clear();
}
public function clearPhotos(): void
{
$this->photos->clear();
}
public function getLot()
{
return $this->lot;
}
public function setLot($lot): void
{
$this->lot = $lot;
}
public function getLotComplement()
{
return $this->lotComplement;
}
public function setLotComplement($lotComplement): void
{
$this->lotComplement = $lotComplement;
}
public function isOrdered()
{
return (bool) $this->ordered;
}
public function setOrdered($ordered): void
{
$this->ordered = $ordered;
}
public function getSalingState()
{
return $this->salingState;
}
public function setSalingState($state): void
{
$this->salingState = $state;
}
public function getWinner()
{
return $this->winner;
}
public function setWinner($winner = null): void
{
$this->winner = $winner;
}
public function getClass()
{
return $this->class;
}
public function setClass($class): void
{
$this->class = $class;
}
public function getMaker()
{
return $this->maker;
}
public function setMaker($maker): void
{
$this->maker = $maker;
}
public function getMakerSlug()
{
return $this->makerSlug;
}
public function setMakerSlug($makerSlug): void
{
$this->makerSlug = $makerSlug;
}
public function getModelGroup()
{
return $this->modelGroup;
}
public function setModelGroup($modelGroup): void
{
$this->modelGroup = $modelGroup;
}
public function getModelGroupSlug()
{
return $this->modelGroupSlug;
}
public function setModelGroupSlug($modelGroupSlug): void
{
$this->modelGroupSlug = $modelGroupSlug;
}
public function getSegment()
{
return $this->segment;
}
public function setSegment($segment): void
{
$this->segment = $segment;
}
public function getSegmentSlug()
{
return $this->segmentSlug;
}
public function setSegmentSlug($segmentSlug): void
{
$this->segmentSlug = $segmentSlug;
}
public function getSegmentSize()
{
return $this->segmentSize;
}
public function setSegmentSize($segmentSize): void
{
$this->segmentSize = $segmentSize;
}
public function getSegmentSizeSlug()
{
return $this->segmentSizeSlug;
}
public function setSegmentSizeSlug($segmentSizeSlug): void
{
$this->segmentSizeSlug = $segmentSizeSlug;
}
public function getSegmentBody()
{
return $this->segmentBody;
}
public function setSegmentBody($segmentBody): void
{
$this->segmentBody = $segmentBody;
}
public function getSegmentTransmission()
{
return $this->segmentTransmission;
}
public function setSegmentTransmission(Transmission $segmentTransmission): void
{
$this->segmentTransmission = $segmentTransmission;
}
public function getCategory()
{
return $this->category;
}
public function setCategory(Category $category): void
{
$this->category = $category;
}
public function getModel()
{
return $this->model;
}
public function setModel($model): void
{
$this->model = $model;
}
public function getTypeCode()
{
return $this->typeCode;
}
public function setTypeCode($typeCode): void
{
$this->typeCode = $typeCode;
}
public function getMillesime()
{
return $this->millesime;
}
public function setMillesime($millesime): void
{
$this->millesime = $millesime;
}
public function getRegistrationDate()
{
return $this->registrationDate;
}
public function setRegistrationdate($registrationDate): void
{
$this->registrationDate = $registrationDate;
}
public function getKilometers()
{
return $this->kilometers;
}
public function setKilometers($kilometers): void
{
$this->kilometers = $kilometers;
}
public function getTaxHorsepower()
{
return $this->taxHorsepower;
}
public function setTaxHorsepower($taxHorsepower): void
{
$this->taxHorsepower = $taxHorsepower;
}
public function getEnergy()
{
return $this->energy;
}
public function setEnergy(Energy $energy): void
{
$this->energy = $energy;
}
public function getBodyType()
{
return $this->bodyType;
}
public function setBodyType($bodyType): void
{
$this->bodyType = $bodyType;
}
/**
* @return Color
*/
public function getColor()
{
return $this->color;
}
public function setColor(Color $color): void
{
$this->color = $color;
}
public function getStateDetails()
{
return $this->stateDetails;
}
public function setStateDetails($stateDetails): void
{
$this->stateDetails = $stateDetails;
}
public function getGuarantee()
{
return $this->guarantee;
}
public function setGuarantee($guarantee): void
{
$this->guarantee = $guarantee;
}
public function isGuaranteed()
{
return (bool) $this->guaranteed;
}
public function setGuaranteed($guaranteed): void
{
$this->guaranteed = $guaranteed;
}
public function getPremiumGuarantee()
{
return $this->premiumGuarantee;
}
public function setPremiumGuarantee($guarantee): void
{
$this->premiumGuarantee = $guarantee;
}
public function hasPremiumGuarantee()
{
return (bool) $this->premiumGuarantee;
}
public function getPremiumGuaranteeDescription()
{
return $this->premiumGuaranteeDescription;
}
public function setPremiumGuaranteeDescription($description): void
{
$this->premiumGuaranteeDescription = $description;
}
public function getStateRating()
{
return $this->stateRating;
}
public function setStateRating($stateRating): void
{
$this->stateRating = $stateRating;
}
public function getAfnor()
{
return $this->afnor;
}
public function setAfnor($afnor): void
{
$this->afnor = $afnor;
}
public function getEtincelleId()
{
return $this->etincelleId;
}
public function setEtincelleId($etincelleId): void
{
$this->etincelleId = $etincelleId;
}
public function getIridiumId()
{
return $this->iridiumId;
}
public function setIridiumId($iridiumId): void
{
$this->iridiumId = $iridiumId;
}
public function getVin()
{
return $this->vin;
}
public function setVin(string $vin): void
{
$this->vin = $vin;
}
public function hasVat()
{
return (bool) $this->vat;
}
public function setVat($vat): void
{
$this->vat = $vat;
}
public function getSeatCount()
{
return $this->seatCount;
}
public function setSeatCount($seatCount): void
{
$this->seatCount = $seatCount;
}
public function getObservation()
{
return $this->observation;
}
public function getObservationItems()
{
$items = explode('-', (string) $this->getObservation());
if (1 == count($items) && '' == $items[0]) {
return '';
}
foreach ($items as $k => $item) {
if (empty($item)) {
unset($items[$k]);
}
}
return '<li>'.implode('</li><li>', $items).'</li>';
}
public function setObservation($observation): void
{
$this->observation = $observation;
}
public function setMotFileUrl($motFileUrl): void
{
$this->motFileUrl = $motFileUrl;
}
public function getMotFileUrl()
{
return $this->motFileUrl;
}
public function hasMotFile()
{
return (bool) $this->motFileUrl;
}
public function getMaintenanceFileUrl()
{
return $this->maintenanceFileUrl;
}
public function setMaintenanceFileUrl($maintenanceFileUrl): void
{
$this->maintenanceFileUrl = $maintenanceFileUrl;
}
public function hasMaintenanceFile()
{
return (bool) $this->maintenanceFileUrl;
}
public function getRoadTestFileUrl()
{
return $this->roadTestFileUrl;
}
public function setRoadTestFileUrl($roadTestFileUrl): void
{
$this->roadTestFileUrl = $roadTestFileUrl;
}
public function hasRoadTestFile()
{
return (bool) $this->roadTestFileUrl;
}
public function getBilanExpertFileUrl()
{
return $this->bilanExpertFileUrl;
}
public function hasBilanExpertFile()
{
return (bool) $this->bilanExpertFileUrl;
}
public function setBilanExpertFileUrl($bilanExpertFileUrl): void
{
$this->bilanExpertFileUrl = $bilanExpertFileUrl;
}
public function getPhoto3dExteriorUrl()
{
return $this->photo3dExteriorUrl;
}
public function setPhoto3dExteriorUrl($photo3dExteriorUrl): void
{
$this->photo3dExteriorUrl = $photo3dExteriorUrl;
}
public function getPhoto3dExteriorExtraUrl()
{
return $this->photo3dExteriorExtraUrl;
}
public function setPhoto3dExteriorExtraUrl($photo3dExteriorExtraUrl): void
{
$this->photo3dExteriorExtraUrl = $photo3dExteriorExtraUrl;
}
public function hasPhoto3d()
{
return (bool) $this->photo3dExteriorUrl;
}
public function getExplodedViewFileUrl()
{
return $this->explodedViewFileUrl;
}
public function setExplodedViewFileUrl($explodedViewFileUrl): void
{
$this->explodedViewFileUrl = $explodedViewFileUrl;
}
public function hasExplodedViewFile()
{
return (bool) $this->explodedViewFileUrl;
}
public function getDekraUrl()
{
return $this->dekraUrl;
}
public function setDekraUrl($dekraUrl): void
{
$this->dekraUrl = $dekraUrl;
}
public function hasInspectionReport()
{
return (bool) $this->inspectionReportUrl;
}
public function getInspectionReportUrl()
{
return $this->inspectionReportUrl;
}
public function setInspectionReportUrl($inspectionReportUrl): void
{
$this->inspectionReportUrl = $inspectionReportUrl;
}
public function getArgusPrice()
{
return $this->argusPrice;
}
public function setArgusPrice($argusPrice): void
{
$this->argusPrice = $argusPrice;
}
public function getArgusTransactionPrice()
{
return $this->argusTransactionPrice;
}
public function setArgusTransactionPrice($argusTransactionPrice): void
{
$this->argusTransactionPrice = $argusTransactionPrice;
}
public function getArgusAnnoncePrice()
{
return $this->argusAnnoncePrice;
}
public function setArgusAnnoncePrice($argusAnnoncePrice): void
{
$this->argusAnnoncePrice = $argusAnnoncePrice;
}
public function getArgusDatedPrice()
{
return $this->argusDatedPrice;
}
public function setArgusDatedPrice($argusDatedPrice): void
{
$this->argusDatedPrice = $argusDatedPrice;
}
public function getArgusKmPrice()
{
return $this->argusKmPrice;
}
public function setArgusKmPrice($argusKmPrice): void
{
$this->argusKmPrice = $argusKmPrice;
}
public function getSpotPrice()
{
return $this->spotPrice;
}
public function setSpotPrice($spotPrice): void
{
$this->spotPrice = $spotPrice;
}
public function getDatedQuote()
{
return max($this->argusDatedPrice, round($this->spotPrice / 100) * 100);
}
public function getReconditioningPrice()
{
return $this->reconditioningPrice;
}
public function setReconditioningPrice($reconditioningPrice): void
{
$this->reconditioningPrice = $reconditioningPrice;
}
public function getEstimationPrice()
{
return $this->estimationPrice;
}
public function setEstimationPrice($estimationPrice): void
{
$this->estimationPrice = $estimationPrice;
}
public function getEstimationPriceMin()
{
return $this->estimationPriceMin;
}
public function setEstimationPriceMin($estimationPriceMin): void
{
$this->estimationPriceMin = $estimationPriceMin;
}
public function getEstimationPriceHF()
{
return $this->estimationPriceHF;
}
public function setEstimationPriceHF($estimationPriceHF): void
{
$this->estimationPriceHF = $estimationPriceHF;
}
public function getInitialReservePrice()
{
return $this->initialReservePrice;
}
public function setInitialReservePrice($initialReservePrice): void
{
$this->initialReservePrice = $initialReservePrice;
}
public function getInitialReservePriceHF()
{
return $this->initialReservePriceHF;
}
public function setInitialReservePriceHF($initialReservePriceHF): void
{
$this->initialReservePriceHF = $initialReservePriceHF;
}
public function getReservePrice()
{
return $this->reservePrice;
}
public function setReservePrice($reservePrice): void
{
$this->reservePrice = $reservePrice;
}
public function getReservePriceHF()
{
return $this->reservePriceHF;
}
public function setReservePriceHF($reservePriceHF): void
{
$this->reservePriceHF = $reservePriceHF;
}
public function getDeltaReservePrice()
{
return $this->deltaReservePrice;
}
public function setOldReservePrice($oldReservePrice): void
{
$this->oldReservePrice = $oldReservePrice;
}
public function getOldReservePrice()
{
return $this->oldReservePrice;
}
public function getOldReservePriceHF()
{
return $this->oldReservePriceHF;
}
public function setOldReservePriceHF($oldReservePriceHF): void
{
$this->oldReservePriceHF = $oldReservePriceHF;
}
public function setDeltaReservePrice($deltaReservePrice): void
{
$this->deltaReservePrice = $deltaReservePrice;
}
public function getDeltaFees()
{
return $this->deltaFees;
}
public function setDeltaFees($deltaFees): void
{
$this->deltaFees = $deltaFees;
}
public function getDeltaAdjustment()
{
return ($this->deltaFees + $this->deltaReservePrice) * (-1);
}
public function getUnusedPrice()
{
return $this->unusedPrice;
}
public function setUnusedPrice($unusedPrice): void
{
$this->unusedPrice = $unusedPrice;
}
public function getStartingPrice(): int
{
return intval($this->startingPrice);
}
public function setStartingPrice($startingPrice): void
{
$this->startingPrice = $startingPrice;
}
public function getBuyoutPrice()
{
return $this->buyoutPrice;
}
public function setBuyoutPrice($buyoutPrice): void
{
$this->buyoutPrice = $buyoutPrice;
}
public function getUnsoldPrice()
{
return $this->unsoldPrice;
}
public function setUnsoldPrice($unsoldPrice): void
{
$this->unsoldPrice = $unsoldPrice;
}
public function getUnsoldOnlinePrice()
{
return $this->unsoldOnlinePrice;
}
public function setUnsoldOnlinePrice($unsoldOnlinePrice): void
{
$this->unsoldOnlinePrice = $unsoldOnlinePrice;
}
public function getLastHammerPrice()
{
return $this->lastHammerPrice;
}
public function setLastHammerPrice($lastHammerPrice): void
{
$this->lastHammerPrice = $lastHammerPrice;
}
public function getFinalAmount()
{
return $this->finalAmount;
}
public function setFinalAmount($finalAmount): void
{
$this->finalAmount = $finalAmount;
}
public function getUnsoldCount()
{
return $this->unsoldCount;
}
public function setUnsoldCount($unsoldCount): void
{
$this->unsoldCount = $unsoldCount;
}
public function getUnsoldOnlineCount()
{
return $this->unsoldOnlineCount;
}
public function setUnsoldOnlineCount($unsoldOnlineCount): void
{
$this->unsoldOnlineCount = $unsoldOnlineCount;
}
public function isBroken()
{
return (bool) $this->broken;
}
public function setBroken($broken): void
{
$this->broken = $broken;
}
public function hasDuplicateKeys()
{
return (bool) $this->duplicateKeys;
}
public function setDuplicateKeys($duplicateKeys): void
{
$this->duplicateKeys = $duplicateKeys;
}
public function getCo2()
{
return $this->co2;
}
public function setCo2($co2): void
{
$this->co2 = $co2;
}
public function getEuroEmissionStandard()
{
return $this->euroEmissionStandard;
}
public function setEuroEmissionStandard($euroEmissionStandard): void
{
$this->euroEmissionStandard = $euroEmissionStandard;
}
public function getShortModel()
{
return $this->shortModel;
}
public function setShortModel($shortModel): void
{
$this->shortModel = $shortModel;
}
public function getVersion()
{
return $this->version;
}
public function setVersion($version): void
{
$this->version = $version;
}
public function getLength()
{
return $this->length;
}
public function setLength($length): void
{
$this->length = $length;
}
public function getWidth()
{
return $this->width;
}
public function setWidth($width): void
{
$this->width = $width;
}
public function getHeight()
{
return $this->height;
}
public function setHeight($height): void
{
$this->height = $height;
}
public function setTarification($tarification): void
{
$this->tarification = $tarification;
}
public function getTarification()
{
return $this->tarification;
}
public function getTarificationType()
{
return $this->tarificationType;
}
public function setTarificationType($tarificationType): void
{
$this->tarificationType = $tarificationType;
}
public function getZipCodeLocation()
{
return $this->zipCodeLocation;
}
public function setZipCodeLocation($zipCodeLocation)
{
return $this->zipCodeLocation = str_pad((string) $zipCodeLocation, 2, '0', STR_PAD_LEFT);
}
public function getCityLocation()
{
return $this->cityLocation;
}
public function setCityLocation($cityLocation): void
{
$this->cityLocation = $cityLocation;
}
public function getLocalization()
{
return $this->zipCodeLocation.((!empty($this->zipCodeLocation) && !empty($this->cityLocation)) ? ' - ' : '').$this->cityLocation;
}
public function getLotOpen()
{
return $this->getSale()->getOpenedVehicle() === $this;
}
public function isLotOpen()
{
return $this->getLotOpen();
}
public function setLotOpen($open)
{
if ($open) {
$this->getSale()->setOpenedVehicle($this);
} else {
$this->getSale()->setOpenedVehicle(null);
}
return $this;
}
public function isJustOpened()
{
return $this->justOpened;
}
public function setJustOpened($justOpened): void
{
$this->justOpened = (bool) $justOpened;
}
public function getNbViews()
{
return $this->nbViews;
}
public function setNbViews($nbViews): void
{
$this->nbViews = $nbViews;
}
public function addOneToNbViews(): void
{
++$this->nbViews;
}
public function isNoShipping()
{
return (bool) $this->noShipping;
}
public function setNoShipping($noShipping): void
{
$this->noShipping = $noShipping;
}
public function getSalesperson()
{
return $this->salesperson;
}
public function setSalesperson($salesperson): void
{
$this->salesperson = $salesperson;
}
public function getEtincelleCreatedAt()
{
return $this->etincelleCreatedAt;
}
public function setEtincelleCreatedAt($etincelleCreatedAt): void
{
$this->etincelleCreatedAt = $etincelleCreatedAt;
}
public function getEtincelleSalingState($etincelleSalingState): void
{
$this->etincelleSalingState = $etincelleSalingState;
}
public function setEtincelleSalingState($etincelleSalingState): void
{
$this->etincelleSalingState = $etincelleSalingState;
}
public function getEtincelleSalingStateComplement($etincelleSalingStateComplement): void
{
$this->etincelleSalingStateComplement = $etincelleSalingStateComplement;
}
public function setEtincelleSalingStateComplement($etincelleSalingStateComplement): void
{
$this->etincelleSalingStateComplement = $etincelleSalingStateComplement;
}
public function isUrgent()
{
return (bool) $this->urgent;
}
public function setUrgent($urgent): void
{
$this->urgent = $urgent;
}
public function getMandateDate()
{
return $this->mandateDate;
}
public function setMandateDate($mandateDate): void
{
$this->mandateDate = $mandateDate;
}
public function getSoldDate()
{
return $this->soldDate;
}
public function setSoldDate($soldDate): void
{
$this->soldDate = $soldDate;
}
public function getRegistrationPlate()
{
return $this->registrationPlate;
}
public function setRegistrationPlate($registrationPlate): void
{
$this->registrationPlate = $registrationPlate;
}
public function isAdjustable()
{
return (bool) $this->adjustable;
}
public function setAdjustable($adjustable): void
{
$this->adjustable = $adjustable;
}
public function getEmptyWeight()
{
return $this->emptyWeight;
}
public function setEmptyWeight($emptyWeight): void
{
$this->emptyWeight = $emptyWeight;
}
public function getLiftingCapacity()
{
return $this->liftingCapacity;
}
public function setLiftingCapacity($liftingCapacity): void
{
$this->liftingCapacity = $liftingCapacity;
}
public function getLiftingHeight()
{
return $this->liftingHeight;
}
public function setLiftingHeight($liftingHeight): void
{
$this->liftingHeight = $liftingHeight;
}
public function getEngineActualHourCount()
{
return $this->engineActualHourCount;
}
public function setEngineActualHourCount($engineActualHourCount): void
{
$this->engineActualHourCount = $engineActualHourCount;
}
public function getWheelBase()
{
return $this->wheelBase;
}
public function setWheelBase($wheelBase): void
{
$this->wheelBase = $wheelBase;
}
public function getCylinderCount()
{
return $this->cylinderCount;
}
public function setCylinderCount($cylinderCount): void
{
$this->cylinderCount = $cylinderCount;
}
public function getDoorCount()
{
return $this->doorCount;
}
public function setDoorCount($doorCount): void
{
$this->doorCount = $doorCount;
}
public function getGearCount()
{
return $this->gearCount;
}
public function setGearCount($gearCount): void
{
$this->gearCount = $gearCount;
}
public function getDriveWheel()
{
return $this->driveWheel;
}
public function setDriveWheel($driveWheel): void
{
$this->driveWheel = $driveWheel;
}
public function getLoadWeight()
{
return $this->loadWeight;
}
public function setLoadWeight($loadWeight): void
{
$this->loadWeight = $loadWeight;
}
public function getHorsePower()
{
return $this->horsePower;
}
public function setHorsePower($horsePower): void
{
$this->horsePower = $horsePower;
}
public function getGearbox()
{
return $this->gearbox;
}
public function setGearbox($gearbox): void
{
$this->gearbox = $gearbox;
}
public function getMaintenanceBookState()
{
return $this->maintenanceBookState;
}
public function setMaintenanceBookState($maintenanceBookState): void
{
$this->maintenanceBookState = $maintenanceBookState;
}
public function getMaintenanceFileState()
{
return $this->maintenanceFileState;
}
public function setMaintenanceFileState($maintenanceFileState): void
{
$this->maintenanceFileState = $maintenanceFileState;
}
public function hasMaintenanceFileState()
{
return (bool) $this->maintenanceFileState;
}
public function hasMakerGuarantee()
{
return (bool) $this->makerGuarantee;
}
public function getMakerGuarantee()
{
return $this->makerGuarantee;
}
public function setMakerGuarantee($makerGuarantee): void
{
$this->makerGuarantee = $makerGuarantee;
}
public function getMakerGuaranteeExpiredAt()
{
return $this->makerGuaranteeExpiredAt;
}
public function setMakerGuaranteeExpiredAt($makerGuaranteeExpiredAt): void
{
$this->makerGuaranteeExpiredAt = $makerGuaranteeExpiredAt;
}
public function getMakerGuaranteeKilometers()
{
return $this->makerGuaranteeKilometers;
}
public function setMakerGuaranteeKilometers($makerGuaranteeKilometers): void
{
$this->makerGuaranteeKilometers = $makerGuaranteeKilometers;
}
public function getSegmentFirst()
{
return $this->segmentFirst;
}
public function setSegmentFirst($segmentFirst): void
{
$this->segmentFirst = $segmentFirst;
}
public function isFirstHand()
{
return (bool) $this->firstHand;
}
public function setFirstHand($firstHand): void
{
$this->firstHand = $firstHand;
}
public function getArgusOID()
{
return $this->argusOID;
}
public function setArgusOID($argusOID): void
{
$this->argusOID = $argusOID;
}
public function getNatCode()
{
return $this->natCode;
}
public function setNatCode($natCode): void
{
$this->natCode = $natCode;
}
public function isDamaged()
{
return (bool) $this->damaged;
}
public function setDamaged($damaged): void
{
$this->damaged = $damaged;
}
public function getSellerObservation()
{
return $this->sellerObservation;
}
public function setSellerObservation($sellerObservation): void
{
$this->sellerObservation = $sellerObservation;
}
public function isTrainingVehicle()
{
return (bool) $this->trainingVehicle;
}
public function setTrainingVehicle($trainingVehicle): void
{
$this->trainingVehicle = $trainingVehicle;
}
public function isTaxi()
{
return (bool) $this->taxi;
}
public function setTaxi($taxi): void
{
$this->taxi = $taxi;
}
public function isMechanicallyDamaged()
{
return (bool) $this->mechanicallyDamaged;
}
public function setMechanicallyDamaged($mechanicallyDamaged): void
{
$this->mechanicallyDamaged = $mechanicallyDamaged;
}
public function getInnerStateRating()
{
return $this->innerStateRating;
}
public function setInnerStateRating($innerStateRating): void
{
$this->innerStateRating = $innerStateRating;
}
public function getExpertiseRating()
{
return $this->expertiseRating;
}
public function setExpertiseRating($expertiseRating): void
{
$this->expertiseRating = $expertiseRating;
}
public function isHighlight()
{
return (bool) $this->highlight;
}
public function setHighlight($highlight): void
{
$this->highlight = $highlight;
}
public function isCatalog()
{
return (bool) $this->catalog;
}
public function setCatalog($catalog): void
{
$this->catalog = $catalog;
}
public function isCatalogHighlight()
{
return (bool) $this->catalogHighlight;
}
public function setCatalogHighlight($catalogHighlight): void
{
$this->catalogHighlight = $catalogHighlight;
}
public function isStar()
{
return (bool) $this->star;
}
public function setStar($star): void
{
$this->star = $star;
}
public function isStarElectro()
{
return (bool) $this->starElectro;
}
public function setStarElectro($starElectro): void
{
$this->starElectro = $starElectro;
}
public function setSeller(Seller $seller): void
{
$this->seller = $seller;
}
public function getSeller()
{
return $this->seller;
}
public function isSentToSap()
{
return (bool) $this->sentToSap;
}
public function setSentToSap($sentToSap): void
{
$this->sentToSap = $sentToSap;
}
public function getCritair()
{
return $this->critair;
}
public function setCritair($critair): void
{
$this->critair = $critair;
}
public function addBehaviour(VehicleBehaviour $behaviour)
{
$this->behaviours[] = $behaviour;
$behaviour->setVehicle($this);
return $this;
}
public function removeBehaviour(VehicleBehaviour $behaviour): void
{
$this->behaviours->removeElement($behaviour);
}
public function getBehaviours()
{
return $this->behaviours;
}
public function getSellerCallback()
{
return $this->sellerCallback;
}
public function setSellerCallback($sellerCallback): void
{
$this->sellerCallback = $sellerCallback;
}
public function getDeliveryRequest()
{
return (bool) $this->deliveryRequest;
}
public function setDeliveryRequest($deliveryRequest): void
{
$this->deliveryRequest = $deliveryRequest;
}
public function getIdentificationType()
{
return $this->identificationType;
}
public function setIdentificationType($identificationType): void
{
$this->identificationType = $identificationType;
}
public function getEtincelleReservePrice()
{
return $this->etincelleReservePrice;
}
public function setEtincelleReservePrice($etincelleReservePrice): void
{
$this->etincelleReservePrice = $etincelleReservePrice;
}
public function getEtincelleReservePriceHF()
{
return $this->etincelleReservePriceHF;
}
public function setEtincelleReservePriceHF($etincelleReservePriceHF): void
{
$this->etincelleReservePriceHF = $etincelleReservePriceHF;
}
public function getSellerEstimationPrice()
{
return $this->sellerEstimationPrice;
}
public function setSellerEstimationPrice($sellerEstimationPrice): void
{
$this->sellerEstimationPrice = $sellerEstimationPrice;
}
public function getSellerEstimationPriceHF()
{
return $this->sellerEstimationPriceHF;
}
public function setSellerEstimationPriceHF($sellerEstimationPriceHF): void
{
$this->sellerEstimationPriceHF = $sellerEstimationPriceHF;
}
public function getCocFileUrl()
{
return $this->cocFileUrl;
}
public function hasCocFile()
{
return (bool) $this->cocFileUrl;
}
public function setCocFileUrl($cocFileUrl): void
{
$this->cocFileUrl = $cocFileUrl;
}
public function getCarpassFileUrl()
{
return $this->carpassFileUrl;
}
public function hasCarpassFile()
{
return (bool) $this->carpassFileUrl;
}
public function setCarpassFileUrl($carpassFileUrl): void
{
$this->carpassFileUrl = $carpassFileUrl;
}
public function getFirstCountryRegistration()
{
return $this->firstCountryRegistration;
}
public function setFirstCountryRegistration($firstCountryRegistration): void
{
$this->firstCountryRegistration = $firstCountryRegistration;
}
public function getCo2Standard()
{
return $this->co2Standard;
}
public function setCo2Standard($co2Standard): void
{
$this->co2Standard = $co2Standard;
}
public function getValueOfOption($option)
{
if (!isset($this->$option)) {
return null;
}
return $this->$option;
}
public function isSellableOnline()
{
return Sale::TYPE_ONLINE === $this->event->getSale()->getType();
}
public function getPICount()
{
return count($this->purchaseInstructions);
}
public function getBidCount()
{
return count($this->auction->getBids());
}
public function hasOffer()
{
if (Sale::TYPE_ONLINE === $this->getSale()->getType()) {
return $this->getBidCount() > 0;
}
return $this->getPICount() > 0;
}
public function isReserveReached()
{
if (Sale::OPTION_GP === $this->getSale()->getPublic()) {
return true;
}
if (Sale::TYPE_ONLINE === $this->getSale()->getType()) {
return $this->finalAmount >= $this->getReservePrice();
}
$hp = $this->getHighestPurchaseInstruction();
if (null !== $hp) {
return $hp->getAmount() >= $this->getReservePrice();
}
return false;
}
public function isBuyoutReached()
{
if (
Sale::TYPE_ONLINE !== $this->getSale()->getType()
|| !in_array($this->getSale()->getSalingType(), [Sale::SALING_STATE_MIXED, Sale::SALING_STATE_BUYOUT])
) {
return false;
}
return $this->finalAmount >= $this->buyoutPrice;
}
public function isClosed()
{
return self::SALING_STATE_ADJUGE === $this->getSalingState() ? true : false;
}
public function getSlug()
{
$str = sprintf('%s %s', $this->maker, $this->model);
$a = ['À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'Ð', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', '?', '?', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', '?', '?', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', '?', 'O', 'o', 'O', 'o', 'O', 'o', 'Œ', 'œ', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'Š', 'š', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Ÿ', 'Z', 'z', 'Z', 'z', 'Ž', 'ž', '?', 'ƒ', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', '?', '?', '?', '?', '?', '?'];
$b = ['A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'];
$slug = strtolower((string) preg_replace(['/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'], ['', '-', ''], str_replace($a, $b, $str)));
return $slug;
}
public function getReadableVehicleOptions($delimiter = ' ')
{
$options = [];
foreach ($this->getOptions() as $vehicleOption) {
$options[] = $vehicleOption->getName();
}
return implode($delimiter, $options);
}
public function isCurrentlyLive()
{
$now = new \DateTime();
return $this->getSale()->isLiveCompatible() && $this->getSale()->getStartDate() <= $now && $this->getSale()->getEndDate() >= $now;
}
public function isStartingPriceAvailable()
{
if (Sale::TYPE_ONLINE === $this->getSale()->getType()) {
return $this->startingPrice > 0;
}
return $this->startingPrice > 0 && $this->estimationPrice > 0;
}
public function getFinalAmountOrInitialStartingPrice()
{
return $this->finalAmount > 0 ? $this->finalAmount : $this->startingPrice;
}
public function isPiAvailable()
{
return $this->isStartingPriceAvailable() && in_array($this->salingState, [self::SALING_STATE_NONE, self::SALING_STATE_RETIRE]);
}
public function getBiddingEndDateTime()
{
if (Sale::TYPE_ONLINE === $this->getSale()->getType()) {
return $this->auction->getClosedAt();
}
return $this->event->getStartDateTime();
}
public function getMaxAnimationAmount()
{
$bidIncrement = $this->getSale()->getBidIncrement();
if ($this->estimationPrice > $this->reservePrice) {
$animMax = $this->estimationPrice + ($this->estimationPrice * self::MAX_ANIMATION_PERCENT / 100);
return (int) (floor($animMax / $bidIncrement) * $bidIncrement);
}
return $this->reservePrice - $bidIncrement;
}
public function getMandateDayCount()
{
$startDart = $this->mandateDate ?: $this->etincelleCreatedAt;
$endDate = $this->soldDate ?: $this->getSale()->getEndDate();
$nbjm = $startDart->diff($endDate);
return $nbjm->format('%R%a');
}
public function notEligibleForPostSale(): bool
{
if (in_array(mb_strtoupper((string) $this->getSeller()->getName()), self::SELLER_NOT_ELIGIBLE_POST_SALE)) {
return true;
}
return false;
}
/**
* @return null
*/
public function getDataHubUUID()
{
return $this->dataHubUUID;
}
/**
* @param null $dataHubUUID
*/
public function setDataHubUUID($dataHubUUID): void
{
$this->dataHubUUID = $dataHubUUID;
}
public function getSapFile(): ?string
{
return $this->sapFile;
}
public function setSapFile(?string $sapFile): void
{
$this->sapFile = $sapFile;
}
}