src/Flexy/ShopBundle/Entity/Shipping/Vehicle/EquipmentVehicle.php line 14
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping\Vehicle;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Shipping\Vehicle\EquipmentVehicleRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EquipmentVehicleRepository::class)]
#[ApiResource]
class EquipmentVehicle
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $title = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\ManyToMany(targetEntity: ShippingVehicle::class, mappedBy: 'equipments')]
private Collection $shippingVehicles;
public function __toString()
{
return $this->title;
}
public function __construct()
{
$this->shippingVehicles = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, ShippingVehicle>
*/
public function getShippingVehicles(): Collection
{
return $this->shippingVehicles;
}
public function addShippingVehicle(ShippingVehicle $shippingVehicle): self
{
if (!$this->shippingVehicles->contains($shippingVehicle)) {
$this->shippingVehicles->add($shippingVehicle);
$shippingVehicle->addEquipment($this);
}
return $this;
}
public function removeShippingVehicle(ShippingVehicle $shippingVehicle): self
{
if ($this->shippingVehicles->removeElement($shippingVehicle)) {
$shippingVehicle->removeEquipment($this);
}
return $this;
}
}