src/Flexy/ShopBundle/Entity/Shipping/Vehicle/VehicleRentType.php line 13
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping\Vehicle;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Shipping\Vehicle\VehicleRentTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: VehicleRentTypeRepository::class)]
#[ApiResource]
class VehicleRentType
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\OneToMany(mappedBy: 'vehicleRentType', targetEntity: ShippingVehicle::class)]
private Collection $shippingVehicles;
public function __construct()
{
$this->shippingVehicles = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
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->setVehicleRentType($this);
}
return $this;
}
public function removeShippingVehicle(ShippingVehicle $shippingVehicle): self
{
if ($this->shippingVehicles->removeElement($shippingVehicle)) {
// set the owning side to null (unless already changed)
if ($shippingVehicle->getVehicleRentType() === $this) {
$shippingVehicle->setVehicleRentType(null);
}
}
return $this;
}
}