src/Entity/Garages/GarageAboutUs.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Garages;
  3. use App\Entity\AbstractBase;
  4. use App\Entity\Interfaces\Image2Interface;
  5. use App\Entity\Interfaces\Image3Interface;
  6. use App\Entity\Interfaces\Image4Interface;
  7. use App\Entity\Interfaces\ImageInterface;
  8. use App\Entity\MiniAbstractBase;
  9. use App\Entity\Traits\DescriptionTrait;
  10. use App\Entity\Traits\HasImage2Trait;
  11. use App\Entity\Traits\HasImage3Trait;
  12. use App\Entity\Traits\HasImage4Trait;
  13. use App\Entity\Traits\HasImageTrait;
  14. use App\Repository\Garages\GarageAboutUsRepository;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Gedmo\Mapping\Annotation as Gedmo;
  17. use Symfony\Component\HttpFoundation\File\File;
  18. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  19. /**
  20.  * @ORM\Table(name="vulco_garage_about_us")
  21.  *
  22.  * @ORM\Entity(repositoryClass=GarageAboutUsRepository::class)
  23.  *
  24.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  25.  *
  26.  * @Vich\Uploadable
  27.  */
  28. class GarageAboutUs extends AbstractBase implements ImageInterfaceImage2InterfaceImage3InterfaceImage4Interface
  29. {
  30.     use DescriptionTrait;
  31.     use HasImageTrait;
  32.     use HasImage2Trait;
  33.     use HasImage3Trait;
  34.     use HasImage4Trait;
  35.     /**
  36.      * @ORM\Column(type="text", length=10000, nullable=true)
  37.      */
  38.     private ?string $description null;
  39.     /**
  40.      * @Vich\UploadableField(mapping="garage_about_us", fileNameProperty="imageName")
  41.      */
  42.     private ?File $image null;
  43.     /**
  44.      * @Vich\UploadableField(mapping="garage_about_us", fileNameProperty="image2Name")
  45.      */
  46.     private ?File $image2 null;
  47.     /**
  48.      * @Vich\UploadableField(mapping="garage_about_us", fileNameProperty="image3Name")
  49.      */
  50.     private ?File $image3 null;
  51.     /**
  52.      * @Vich\UploadableField(mapping="garage_about_us", fileNameProperty="image4Name")
  53.      */
  54.     private ?File $image4 null;
  55.     public function hasAnyImage(): bool
  56.     {
  57.         if (!empty($this->getImageName()) ||
  58.             !empty($this->getImage2Name()) ||
  59.             !empty($this->getImage3Name()) ||
  60.             !empty($this->getImage4Name())
  61.         ) {
  62.             return true;
  63.         }
  64.         return false;
  65.     }
  66.     public function __toString(): string
  67.     {
  68.         return $this->id $this->getDescription() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  69.     }
  70. }