src/Flexy/ShopBundle/Entity/Shipping/ShipmentItemType.php line 14
<?php
namespace App\Flexy\ShopBundle\Entity\Shipping;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Shipping\ShipmentItemTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ShipmentItemTypeRepository::class)]
#[ApiResource]
class ShipmentItemType
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $description = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $createdAt = null;
#[ORM\OneToMany(mappedBy: 'shipmentItemType', targetEntity: ShipmentItem::class)]
private Collection $shipmentItems;
public function __construct()
{
$this->shipmentItems = new ArrayCollection();
}
public function __toString()
{
return $this->name;
}
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;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection<int, ShipmentItem>
*/
public function getShipmentItems(): Collection
{
return $this->shipmentItems;
}
public function addShipmentItem(ShipmentItem $shipmentItem): self
{
if (!$this->shipmentItems->contains($shipmentItem)) {
$this->shipmentItems->add($shipmentItem);
$shipmentItem->setShipmentItemType($this);
}
return $this;
}
public function removeShipmentItem(ShipmentItem $shipmentItem): self
{
if ($this->shipmentItems->removeElement($shipmentItem)) {
// set the owning side to null (unless already changed)
if ($shipmentItem->getShipmentItemType() === $this) {
$shipmentItem->setShipmentItemType(null);
}
}
return $this;
}
}