<?php
namespace App\Entity\Declaration;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Annotation\ApiSubresource;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity
* @ORM\Table(name="brunex_declaration_product")
* @ApiResource(
* routePrefix="/brunex/declaration",
* normalizationContext={"groups"={"product:list"}},
* )
*/
class Product
{
/**
* @var int
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"product", "product:list", "declaration", "declaration:list"})
*/
protected $id;
/**
* @var string
* @ORM\Column(type="text")
* @Groups({"product", "product:list", "declaration", "declaration:list"})
*/
protected $name;
/**
* @var Collection<Definition>
* @ORM\OneToMany(targetEntity="Definition", mappedBy="product", cascade={"persist"})
* @Groups({"product", "declaration"})
* @ApiSubresource
*/
protected $definitions;
/**
* @var Collection<Declaration>
* @ORM\OneToMany(targetEntity="Declaration", mappedBy="product")
* @Groups({"product", "declaration"})
*/
protected $declarations;
/**
* @var Collection<DetailDocument>
* @ORM\OneToMany(targetEntity="DetailDocument", mappedBy="product")
* @Groups({"product", "declaration"})
*/
protected $detailDocuments;
/**
* @var Collection<EvidenceDocument>
* @ORM\OneToMany(targetEntity="EvidenceDocument", mappedBy="product")
* @Groups({"product", "declaration"})
*/
protected $evidenceDocuments;
/**
* @var Collection<RegulationDocument>
* @ORM\OneToMany(targetEntity="RegulationDocument", mappedBy="product")
* @Groups({"product", "declaration"})
*/
protected $regulationDocuments;
/**
* @var Collection<Attachment>
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="product")
* @Groups({"product", "declaration"})
*/
protected $attachments;
/**
* @var int
* @ORM\Column(type="integer")
*/
protected $position = 9999;
public function __construct()
{
$this->definitions = new \Doctrine\Common\Collections\ArrayCollection();
$this->declarations = new \Doctrine\Common\Collections\ArrayCollection();
$this->detailDocuments = new ArrayCollection();
$this->evidenceDocuments = new ArrayCollection();
$this->regulationDocuments = new ArrayCollection();
$this->attachments = new ArrayCollection();
}
public function __toString() {
return $this->name;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*
* @return Product
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* @return Collection
*/
public function getDefinitions()
{
return $this->definitions;
}
/**
* @param Collection $definitions
*
* @return Product
*/
public function setDefinitions($definitions)
{
$this->definitions = $definitions;
return $this;
}
/**
* @return Collection
*/
public function getDeclarations()
{
return $this->declarations;
}
/**
* @param Collection $declarations
*
* @return Product
*/
public function setDeclarations($declarations)
{
$this->declarations = $declarations;
return $this;
}
/**
* @return Collection
*/
public function getDetailDocuments()
{
return $this->detailDocuments;
}
/**
* @param Collection $detailDocuments
*
* @return Product
*/
public function setDetailDocuments($detailDocuments)
{
$this->detailDocuments = $detailDocuments;
return $this;
}
/**
* @return Collection
*/
public function getEvidenceDocuments()
{
return $this->evidenceDocuments;
}
/**
* @param Collection $evidenceDocuments
*
* @return Product
*/
public function setEvidenceDocuments($evidenceDocuments)
{
$this->evidenceDocuments = $evidenceDocuments;
return $this;
}
/**
* @return Collection
*/
public function getRegulationDocuments()
{
return $this->regulationDocuments;
}
/**
* @param Collection $regulationDocuments
*
* @return Product
*/
public function setRegulationDocuments($regulationDocuments)
{
$this->regulationDocuments = $regulationDocuments;
return $this;
}
/**
* @return Collection
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
/**
* @param Collection $attachments
*
* @return Product
*/
public function setAttachments(Collection $attachments): Product
{
$this->attachments = $attachments;
return $this;
}
/**
* @return int
*/
public function getPosition()
{
return $this->position;
}
/**
* @param int $position
*
* @return Product
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
}