src/Entity/Clinic.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Traits\CreatedUpdatedTrait;
  5. use JMS\Serializer\Annotation\Expose;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use JMS\Serializer\Annotation\ExclusionPolicy;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11.  * @ORM\Table(name="v_clinic")
  12.  * @ORM\Entity(repositoryClass="App\Repository\ClinicRepository")
  13.  * @ExclusionPolicy("all")
  14.  * @Gedmo\Loggable
  15.  * @Vich\Uploadable
  16.  */
  17. class Clinic
  18. {
  19.     /**
  20.      * @ORM\Id()
  21.      * @ORM\GeneratedValue()
  22.      * @ORM\Column(type="integer")
  23.      * @Expose
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      * @Expose
  29.      * @Gedmo\Versioned
  30.      */
  31.     private $name;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, unique=true)
  34.      * @Expose
  35.      * @Gedmo\Versioned
  36.      */
  37.     private $email;
  38.     /**
  39.      * @ORM\Column(type="string", length=80, nullable=true)
  40.      * @Expose
  41.      * @Gedmo\Versioned
  42.      */
  43.     private $phone;
  44.     /**
  45.      * @var boolean
  46.      * @ORM\Column(type="boolean")
  47.      * @Expose
  48.      * @Gedmo\Versioned
  49.      */
  50.     private $enabled true;
  51.     /**
  52.      * @Vich\UploadableField(mapping="clinic_image", fileNameProperty="imageName")
  53.      *
  54.      * @var File
  55.      */
  56.     private $imageFile;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      * @Expose
  60.      *
  61.      * @var string
  62.      */
  63.     private $imageName;
  64.     use CreatedUpdatedTrait;
  65.     public function __toString()
  66.     {
  67.         return (string) $this->name;
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     /**
  74.      * @return mixed
  75.      */
  76.     public function getName()
  77.     {
  78.         return $this->name;
  79.     }
  80.     /**
  81.      * @param mixed $name
  82.      */
  83.     public function setName($name): void
  84.     {
  85.         $this->name $name;
  86.     }
  87.     public function getEmail(): ?string
  88.     {
  89.         return $this->email;
  90.     }
  91.     public function setEmail(string $email): self
  92.     {
  93.         $this->email $email;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return mixed
  98.      */
  99.     public function getPhone()
  100.     {
  101.         return $this->phone;
  102.     }
  103.     /**
  104.      * @param mixed $phone
  105.      */
  106.     public function setPhone($phone): void
  107.     {
  108.         $this->phone $phone;
  109.     }
  110.     /**
  111.      * @return bool
  112.      */
  113.     public function isEnabled(): bool
  114.     {
  115.         return $this->enabled;
  116.     }
  117.     /**
  118.      * @param bool $enabled
  119.      */
  120.     public function setEnabled(bool $enabled): void
  121.     {
  122.         $this->enabled $enabled;
  123.     }
  124.     /**
  125.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  126.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  127.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  128.      * must be able to accept an instance of 'File' as the bundle will inject one here
  129.      * during Doctrine hydration.
  130.      *
  131.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  132.      */
  133.     public function setImageFile(File $image null)
  134.     {
  135.         $this->imageFile $image;
  136.         if ($image) {
  137.             // It is required that at least one field changes if you are using doctrine
  138.             // otherwise the event listeners won't be called and the file is lost
  139.             $this->updated = new \DateTime('now');
  140.         }
  141.     }
  142.     /**
  143.      * @return File
  144.      */
  145.     public function getImageFile()
  146.     {
  147.         return $this->imageFile;
  148.     }
  149.     /**
  150.      * @param string $imageName
  151.      */
  152.     public function setImageName($imageName)
  153.     {
  154.         $this->imageName $imageName;
  155.     }
  156.     /**
  157.      * @return string
  158.      */
  159.     public function getImageName()
  160.     {
  161.         return $this->imageName;
  162.     }
  163. }