<?php
namespace App\Entity\Media;
use App\Entity\Media\Document;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\Media\QualityRepository")
* @ORM\Table(name="qualities")
*/
class Quality
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=false)
* @Assert\NotBlank()
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=false)
* @Assert\NotBlank()
*/
private $code;
/**
* @ORM\Column(type="datetime", nullable=false, name="created_date")
* @Gedmo\Timestampable(on="create")
*/
private $createdDate;
/**
* @ORM\Column(type="datetime", nullable=true, name="updated_date")
* @Gedmo\Timestampable(on="update")
*/
private $updatedDate;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Media\Document", mappedBy="quality")
*/
private $documents;
/**
* @ORM\Column(type="integer", nullable=true, name="status")
*/
private $status = 1;
/**
* @ORM\Column(type="integer", nullable=false, name="position")
*/
private $position = 1;
public function __construct()
{
$this->documents = 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;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getCreatedDate(): ?\DateTimeInterface
{
return $this->createdDate;
}
public function getUpdatedDate(): ?\DateTimeInterface
{
return $this->updatedDate;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(?int $status): self
{
$this->status = $status;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(int $position): self
{
$this->position = $position;
return $this;
}
/**
* @return Collection|Document[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->contains($document)) {
$this->documents->removeElement($document);
}
return $this;
}
public function __toString()
{
return $this->getCode().' - '.$this->getName();
}
}