src/Flexy/ShopBundle/Entity/Customer/Pack.php line 13
<?php
namespace App\Flexy\ShopBundle\Entity\Customer;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Customer\PackRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: PackRepository::class)]
class Pack implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private ?string $title = null;
#[ORM\Column(type: 'text')]
private ?string $description = null;
#[ORM\Column(type: 'integer')]
private ?int $nbrProducts = null;
#[ORM\OneToMany(targetEntity: PackEngagement::class, mappedBy: 'pack')]
private \Doctrine\Common\Collections\Collection|array $packEngagements;
#[ORM\Column(type: 'float')]
private ?float $price = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $image = null;
public function __toString(): string
{
return (string) $this->title;
}
public function __construct()
{
$this->packEngagements = 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;
}
public function getNbrProducts(): ?int
{
return $this->nbrProducts;
}
public function setNbrProducts(int $nbrProducts): self
{
$this->nbrProducts = $nbrProducts;
return $this;
}
/**
* @return Collection<int, PackEngagement>
*/
public function getPackEngagements(): Collection
{
return $this->packEngagements;
}
public function addPackEngagement(PackEngagement $packEngagement): self
{
if (!$this->packEngagements->contains($packEngagement)) {
$this->packEngagements[] = $packEngagement;
$packEngagement->setPack($this);
}
return $this;
}
public function removePackEngagement(PackEngagement $packEngagement): self
{
if ($this->packEngagements->removeElement($packEngagement)) {
// set the owning side to null (unless already changed)
if ($packEngagement->getPack() === $this) {
$packEngagement->setPack(null);
}
}
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
}