src/Entity/Bloc.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlocRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassBlocRepository::class)]
  9. class Bloc
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(nullabletrue)]
  16.     private ?int $ordre null;
  17.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  18.     private ?string $description null;
  19.     #[ORM\Column(nullabletrue)]
  20.     private ?array $columns null;
  21.     #[ORM\Column(nullabletrue)]
  22.     private ?array $rowData null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $nom null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $imageFiles null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $titre null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $descriptionimage null;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $emplacement null;
  33.     #[ORM\ManyToOne(inversedBy'blocs')]
  34.     private ?Document $document null;
  35.     #[ORM\Column(length255nullabletrue)]
  36.     private ?string $type null;
  37.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'blocsection')]
  38.     private ?self $bloc null;
  39.     #[ORM\OneToMany(mappedBy'bloc'targetEntityself::class)]
  40.     private Collection $blocsection;
  41.     #[ORM\Column(nullabletrue)]
  42.     private ?bool $actif null;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $config null;
  45.     #[ORM\ManyToOne(inversedBy'bloc')]
  46.     private ?Section $section null;
  47.     public function __construct()
  48.     {
  49.         $this->blocsection = new ArrayCollection();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getOrdre(): ?int
  56.     {
  57.         return $this->ordre;
  58.     }
  59.     public function setOrdre(?int $ordre): static
  60.     {
  61.         $this->ordre $ordre;
  62.         return $this;
  63.     }
  64.     public function getDescription(): ?string
  65.     {
  66.         return $this->description;
  67.     }
  68.     public function setDescription(?string $description): static
  69.     {
  70.         $this->description $description;
  71.         return $this;
  72.     }
  73.     public function getColumns(): ?array
  74.     {
  75.         return $this->columns;
  76.     }
  77.     public function setColumns(?array $columns): static
  78.     {
  79.         $this->columns $columns;
  80.         return $this;
  81.     }
  82.     public function getRowData(): ?array
  83.     {
  84.         return $this->rowData;
  85.     }
  86.     public function setRowData(?array $rowData): static
  87.     {
  88.         $this->rowData $rowData;
  89.         return $this;
  90.     }
  91.     public function getNom(): ?string
  92.     {
  93.         return $this->nom;
  94.     }
  95.     public function setNom(?string $nom): static
  96.     {
  97.         $this->nom $nom;
  98.         return $this;
  99.     }
  100.     public function getImageFiles(): ?string
  101.     {
  102.         return $this->imageFiles;
  103.     }
  104.     public function setImageFiles(?string $imageFiles): static
  105.     {
  106.         $this->imageFiles $imageFiles;
  107.         return $this;
  108.     }
  109.     public function getTitre(): ?string
  110.     {
  111.         return $this->titre;
  112.     }
  113.     public function setTitre(?string $titre): static
  114.     {
  115.         $this->titre $titre;
  116.         return $this;
  117.     }
  118.     public function getDescriptionimage(): ?string
  119.     {
  120.         return $this->descriptionimage;
  121.     }
  122.     public function setDescriptionimage(?string $descriptionimage): static
  123.     {
  124.         $this->descriptionimage $descriptionimage;
  125.         return $this;
  126.     }
  127.     public function getEmplacement(): ?string
  128.     {
  129.         return $this->emplacement;
  130.     }
  131.     public function setEmplacement(?string $emplacement): static
  132.     {
  133.         $this->emplacement $emplacement;
  134.         return $this;
  135.     }
  136.     public function getDocument(): ?Document
  137.     {
  138.         return $this->document;
  139.     }
  140.     public function setDocument(?Document $document): static
  141.     {
  142.         $this->document $document;
  143.         return $this;
  144.     }
  145.     public function getType(): ?string
  146.     {
  147.         return $this->type;
  148.     }
  149.     public function setType(?string $type): static
  150.     {
  151.         $this->type $type;
  152.         return $this;
  153.     }
  154.     public function getBloc(): ?self
  155.     {
  156.         return $this->bloc;
  157.     }
  158.     public function setBloc(?self $bloc): static
  159.     {
  160.         $this->bloc $bloc;
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection<int, self>
  165.      */
  166.     public function getBlocsection(): Collection
  167.     {
  168.         return $this->blocsection;
  169.     }
  170.     public function addBlocsection(self $blocsection): static
  171.     {
  172.         if (!$this->blocsection->contains($blocsection)) {
  173.             $this->blocsection->add($blocsection);
  174.             $blocsection->setBloc($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeBlocsection(self $blocsection): static
  179.     {
  180.         if ($this->blocsection->removeElement($blocsection)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($blocsection->getBloc() === $this) {
  183.                 $blocsection->setBloc(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     public function isActif(): ?bool
  189.     {
  190.         return $this->actif;
  191.     }
  192.     public function setActif(?bool $actif): static
  193.     {
  194.         $this->actif $actif;
  195.         return $this;
  196.     }
  197.     public function getConfig(): ?string
  198.     {
  199.         return $this->config;
  200.     }
  201.     public function getDecodedConfig(): array
  202.     {
  203.         return $this->decodeConfig();
  204.     }
  205.     public function getWidth(): ?string
  206.     {
  207.         $config $this->decodeConfig();
  208.         return $config['width'] ?? null// Return width if it exists, otherwise null
  209.     }
  210.     public function getHeight(): ?string
  211.     {
  212.         $config $this->decodeConfig();
  213.         return $config['height'] ?? null// Return height if it exists, otherwise null
  214.     }
  215.     public function getAlign(): ?string
  216.     {
  217.         $config $this->decodeConfig();
  218.         return $config['align'] ?? null// Return align if it exists, otherwise null
  219.     }
  220.     private function decodeConfig(): array
  221.     {
  222.         if ($this->config === null) {
  223.             return [];
  224.         }
  225.         // Decode the JSON string, return empty array on failure
  226.         $decoded json_decode($this->configtrue);
  227.         return is_array($decoded) ? $decoded : [];
  228.     }
  229.     public function setConfig(?string $config): static
  230.     {
  231.         $this->config $config;
  232.         return $this;
  233.     }
  234.     public function getSection(): ?Section
  235.     {
  236.         return $this->section;
  237.     }
  238.     public function setSection(?Section $section): static
  239.     {
  240.         $this->section $section;
  241.         return $this;
  242.     }
  243. }