src/Flexy/StockBundle/Entity/Document.php line 14
<?php
namespace App\Flexy\StockBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Flexy\ShopBundle\Entity\Order\Order;
use App\Flexy\StockBundle\Repository\DocumentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(repositoryClass: DocumentRepository::class)]
class Document extends Order
{
#[ORM\OneToMany(targetEntity: Stock::class, mappedBy: 'document')]
private \Doctrine\Common\Collections\Collection|array $stocks;
#[ORM\Column(type: 'string', length: 255)]
private ?string $type = null;
public function __construct()
{
$this->stocks = new ArrayCollection();
}
/**
* @return Collection|Stock[]
*/
public function getStocks(): Collection
{
return $this->stocks;
}
public function addStock(Stock $stock): self
{
if (!$this->stocks->contains($stock)) {
$this->stocks[] = $stock;
$stock->setDocument($this);
}
return $this;
}
public function removeStock(Stock $stock): self
{
if ($this->stocks->removeElement($stock)) {
// set the owning side to null (unless already changed)
if ($stock->getDocument() === $this) {
$stock->setDocument(null);
}
}
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
}