src/Entity/Produit/Service/Service.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Produit\Service;
  3. use App\Repository\Produit\Service\ServiceRepository;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use App\Entity\Produit\Service\Service;
  8. use App\Entity\Users\User\User;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @ORM\Table(name="`service`")
  12.  * @ORM\Entity(repositoryClass=ServiceRepository::class)
  13.  * @Vich\Uploadable
  14. */
  15. class Service
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.     */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     public $contentUrl;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      */
  30.     private $filePath;
  31.     /**
  32.      * @Vich\UploadableField(mapping="service_file", fileNameProperty="filePath", size="imageSize", mimeType="mimeType", originalName="originalName")
  33.      * @var File|null
  34.      */
  35.     public ?File $file null;
  36.     /**
  37.      * @ORM\Column(type="string", length=255, nullable=true)
  38.     */
  39.     private $imageSize;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      */
  43.     private $originalName;
  44.     /**
  45.      * @ORM\Column(type="datetime")
  46.      */
  47.     private $date;
  48.     /**
  49.      * @ORM\Column(type="string", length=255, nullable=true)
  50.      */
  51.     private $mimeType;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity=User::class)
  54.      * @ORM\JoinColumn(nullable=false)
  55.      */
  56.     private $user;
  57.     /**
  58.      * @ORM\Column(name="name", type="string", length=255)
  59.      */
  60.     private $name;
  61.     /**
  62.      * @ORM\Column(name="rang", type="integer")
  63.      */
  64.     private $rang;
  65.     /**
  66.      * @ORM\Column(type="text", nullable=true)
  67.      */
  68.     private $description;
  69.     /**
  70.      * @ORM\Column(type="string", length=255, nullable=true)
  71.      */
  72.     private $expertise;
  73.     /**
  74.      * @ORM\Column(type="string", length=255, nullable=true)
  75.      */
  76.     private $motcle;
  77.     /**
  78.      * @ORM\Column(name="parent_id", type="integer", nullable=true)
  79.      */
  80.     private $parentId;
  81.     /**
  82.      * @var json
  83.      *
  84.      * @ORM\Column(name="objectifs", type="json", nullable=true)
  85.      */
  86.     private ?array $objectifs = [];
  87.     private $em;
  88.     public function __construct()
  89.     {
  90.         $this->date = new \Datetime();
  91.         $this->expertise "service";
  92.     }
  93.     public function getId(): ?int
  94.     {
  95.         return $this->id;
  96.     }
  97.     public function getClientExtension()
  98.     {
  99.         $tabextension explode('.'$this->getOriginalName());
  100.         $nbelem count($tabextension);
  101.         if($nbelem 1)
  102.         {
  103.             return $tabextension[$nbelem 1];
  104.         }else{
  105.             return "";
  106.         }
  107.     }
  108.     public function getTimeOfSendingFiles(): string
  109.     {
  110.         if($this->date != null)
  111.         {
  112.             return $this->date->format('Y-m-d H:i:s');
  113.         }else{
  114.             return "0000-00-00 00:00:00";
  115.         }
  116.     }
  117.     public function getContentUrl(): ?string
  118.     {
  119.         return $this->contentUrl;
  120.     }
  121.     public function setContentUrl(?string $contentUrl): self
  122.     {
  123.         $this->contentUrl $contentUrl;
  124.         return $this;
  125.     }
  126.     public function getFilePath(): ?string
  127.     {
  128.         return $this->filePath;
  129.     }
  130.     public function setFilePath(?string $filePath): self
  131.     {
  132.         $this->filePath $filePath;
  133.         return $this;
  134.     }
  135.     public function getImageSize(): ?string
  136.     {
  137.         return $this->imageSize;
  138.     }
  139.     public function setImageSize(?string $imageSize): self
  140.     {
  141.         $this->imageSize $imageSize;
  142.         return $this;
  143.     }
  144.     public function getOriginalName(): ?string
  145.     {
  146.         return $this->originalName;
  147.     }
  148.     public function setOriginalName(?string $originalName): self
  149.     {
  150.         $this->originalName $originalName;
  151.         return $this;
  152.     }
  153.     public function getDate(): ?\DateTimeInterface
  154.     {
  155.         return $this->date;
  156.     }
  157.     public function setDate(\DateTimeInterface $date): self
  158.     {
  159.         $this->date $date;
  160.         return $this;
  161.     }
  162.     public function getMimeType(): ?string
  163.     {
  164.         return $this->mimeType;
  165.     }
  166.     public function setMimeType(string $mimeType null): self
  167.     {
  168.         $this->mimeType $mimeType;
  169.         return $this;
  170.     }
  171.     public function getUser(): ?User
  172.     {
  173.         return $this->user;
  174.     }
  175.     public function setUser(?User $user): self
  176.     {
  177.         $this->user $user;
  178.         return $this;
  179.     }
  180.     public function getName(): ?string
  181.     {
  182.         return $this->name;
  183.     }
  184.     public function setName(string $name): self
  185.     {
  186.         $this->name $name;
  187.         return $this;
  188.     }
  189.     public function getDescription(): ?string
  190.     {
  191.         return $this->description;
  192.     }
  193.     public function setDescription(?string $description): self
  194.     {
  195.         $this->description $description;
  196.         return $this;
  197.     }
  198.     public function getRang(): ?int
  199.     {
  200.         return $this->rang;
  201.     }
  202.     public function setRang(?int $rang): self
  203.     {
  204.         $this->rang $rang;
  205.         return $this;
  206.     }
  207.     public function getExpertise(): ?string
  208.     {
  209.         return $this->expertise;
  210.     }
  211.     public function setExpertise(string $expertise): self
  212.     {
  213.         $this->expertise $expertise;
  214.         return $this;
  215.     }
  216.     public function getParentId(): ?string
  217.     {
  218.         return $this->parentId;
  219.     }
  220.     public function setParentId(string $parentId): self
  221.     {
  222.         $this->parentId $parentId;
  223.         return $this;
  224.     }
  225.     public function getMotcle(): ?string
  226.     {
  227.         return $this->motcle;
  228.     }
  229.     public function setMotcle(string $motcle): self
  230.     {
  231.         $this->motcle $motcle;
  232.         return $this;
  233.     }
  234.     public function getObjectifs(): ?array
  235.     {
  236.         return $this->objectifs;
  237.     }
  238.     public function setObjectifs(?array $objectifs): self
  239.     {
  240.         $this->objectifs $objectifs;
  241.         return $this;
  242.     }
  243.     public function setEm($em)
  244.     {
  245.         $this->em $em;
  246.     }
  247.     public function getEm()
  248.     {
  249.         return $this->em;
  250.     }
  251.     public function getSousService()
  252.     {
  253.         $liste_service $this->em->getRepository(Service::class)
  254.                               ->findBy(array('parentId'=>$this->getId()),array('rang'=>'asc'));
  255.         return $liste_service;
  256.     }
  257.     public function getServiceParent()
  258.     {
  259.         $service $this->em->getRepository(Service::class)
  260.                               ->findOneBy(array('id'=>$this->getParentId()),array('rang'=>'asc'));
  261.         return $service;
  262.     }
  263. }