<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;use App\Traits\CreatedUpdatedTrait;use JMS\Serializer\Annotation\Expose;use Gedmo\Mapping\Annotation as Gedmo;use JMS\Serializer\Annotation\ExclusionPolicy;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;/** * @ORM\Table(name="v_clinic") * @ORM\Entity(repositoryClass="App\Repository\ClinicRepository") * @ExclusionPolicy("all") * @Gedmo\Loggable * @Vich\Uploadable */class Clinic{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") * @Expose */ private $id; /** * @ORM\Column(type="string", length=255) * @Expose * @Gedmo\Versioned */ private $name; /** * @ORM\Column(type="string", length=255, unique=true) * @Expose * @Gedmo\Versioned */ private $email; /** * @ORM\Column(type="string", length=80, nullable=true) * @Expose * @Gedmo\Versioned */ private $phone; /** * @var boolean * @ORM\Column(type="boolean") * @Expose * @Gedmo\Versioned */ private $enabled = true; /** * @Vich\UploadableField(mapping="clinic_image", fileNameProperty="imageName") * * @var File */ private $imageFile; /** * @ORM\Column(type="string", length=255, nullable=true) * @Expose * * @var string */ private $imageName; use CreatedUpdatedTrait; public function __toString() { return (string) $this->name; } public function getId(): ?int { return $this->id; } /** * @return mixed */ public function getName() { return $this->name; } /** * @param mixed $name */ public function setName($name): void { $this->name = $name; } public function getEmail(): ?string { return $this->email; } public function setEmail(string $email): self { $this->email = $email; return $this; } /** * @return mixed */ public function getPhone() { return $this->phone; } /** * @param mixed $phone */ public function setPhone($phone): void { $this->phone = $phone; } /** * @return bool */ public function isEnabled(): bool { return $this->enabled; } /** * @param bool $enabled */ public function setEnabled(bool $enabled): void { $this->enabled = $enabled; } /** * If manually uploading a file (i.e. not using Symfony Form) ensure an instance * of 'UploadedFile' is injected into this setter to trigger the update. If this * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter * must be able to accept an instance of 'File' as the bundle will inject one here * during Doctrine hydration. * * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image */ public function setImageFile(File $image = null) { $this->imageFile = $image; if ($image) { // It is required that at least one field changes if you are using doctrine // otherwise the event listeners won't be called and the file is lost $this->updated = new \DateTime('now'); } } /** * @return File */ public function getImageFile() { return $this->imageFile; } /** * @param string $imageName */ public function setImageName($imageName) { $this->imageName = $imageName; } /** * @return string */ public function getImageName() { return $this->imageName; }}