2022-02-11 16:04:01 +01:00

206 lines
4.2 KiB
PHP

<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\DocStoreBundle\Entity;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\MappedSuperclass
*/
class Document implements HasScopeInterface, TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
/**
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="category_bundle_id", referencedColumnName="bundle_id"),
* @ORM\JoinColumn(name="category_id_inside_bundle", referencedColumnName="id_inside_bundle")
* })
*/
private $category;
/**
* @ORM\Column(type="datetime")
*/
private $date;
/**
* @ORM\Column(type="text")
*/
private $description = '';
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
* cascade={"persist"}
* )
* @Assert\Valid
* @Assert\NotNull(
* message="Upload a document"
* )
*/
private $object;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*
* @var \Chill\MainBundle\Entity\Scope The document's center
*/
private $scope;
/**
* @ORM\ManyToOne(targetEntity="Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate")
*/
private $template;
/**
* @ORM\Column(type="text")
* @Assert\Length(
* min=2, max=250
* )
*/
private $title;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @var \Chill\PersonBundle\Entity\user The user who encoded the exif_read_data
*/
private $user;
public function getCategory(): ?DocumentCategory
{
return $this->category;
}
public function getDate(): ?DateTimeInterface
{
return $this->date;
}
public function getDescription(): ?string
{
return $this->description;
}
public function getId()
{
return $this->id;
}
public function getObject(): ?StoredObject
{
return $this->object;
}
/**
* Get scope.
*
* @return \Chill\MainBundle\Entity\Scope
*/
public function getScope(): ?Scope
{
return $this->scope;
}
public function getTemplate(): ?DocGeneratorTemplate
{
return $this->template;
}
public function getTitle(): ?string
{
return $this->title;
}
public function getUser()
{
return $this->user;
}
public function setCategory(DocumentCategory $category): self
{
$this->category = $category;
return $this;
}
public function setDate(DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function setDescription($description): self
{
$this->description = (string) $description;
return $this;
}
public function setObject(?StoredObject $object = null)
{
$this->object = $object;
return $this;
}
public function setScope($scope): self
{
$this->scope = $scope;
return $this;
}
public function setTemplate(?DocGeneratorTemplate $template): self
{
$this->template = $template;
return $this;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function setUser($user): self
{
$this->user = $user;
return $this;
}
}