<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;use Vich\UploaderBundle\Mapping\Annotation as Vich;/** * @ORM\Entity(repositoryClass="App\Repository\DocumentRepository") */class Document { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="datetime") */ private $created; /** * @ORM\Column(type="string", length=255) */ private $type; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="documents") * @ORM\JoinColumn(nullable=true) */ private $customer; private $link; /** * @ORM\Column(type="datetime") */ private $updated; private $linkFile; /** * Document constructor. * @throws \Exception */ public function __construct() { $this->setCreated(new \DateTime()); $this->setUpdated(new \DateTime()); } /** * @return mixed */ public function getLinkFile() { return $this->linkFile; } /** * @param $linkFile * @throws \Exception */ public function setLinkFile($linkFile): void { $this->linkFile = $linkFile; // dump($linkFile->getExtension()); return; if (!empty($linkFile->getExtension())) { $this->setUpdated(new \DateTime()); $this->setType($linkFile->getExtension()); $this->setName($linkFile->getBasename()); } } public function getId(): ?int { return $this->id; } public function getCreated(): ?\DateTimeInterface { return $this->created; } public function setCreated(\DateTimeInterface $created): self { $this->created = $created; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } public function getLink(): ?string { return $this->link; } public function setLink(?string $link): self { $this->link = $link; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getCustomer(): ?Customer { return $this->customer; } public function setCustomer(?Customer $customer): self { $this->customer = $customer; return $this; } public function getUpdated(): ?\DateTimeInterface { return $this->updated; } public function setUpdated(\DateTimeInterface $updated): self { $this->updated = $updated; return $this; }}