src/Entity/Webfactory/Navigation.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Webfactory;
  3. use App\Entity\Adherent\Magasin;
  4. use App\Repository\Webfactory\NavigationRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassNavigationRepository::class)]
  7. #[ORM\HasLifecycleCallbacks]
  8. class Navigation
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityMagasin::class, inversedBy'navigations')]
  15.     #[ORM\JoinColumn(name'magasin'referencedColumnName'k_adherent'nullablefalse)]
  16.     private $magasin;
  17.     #[ORM\Column(type'text'nullabletrue)]
  18.     private $sort;
  19.     #[ORM\Column(type'string'nullablefalse)]
  20.     private $lang;
  21.     #[ORM\Column(type'datetime_immutable')]
  22.     private $updatedAt;
  23.     public function __construct(){
  24.         $this->updatedAt = new \DateTimeImmutable("now");
  25.     }
  26.     #[ORM\PreUpdate]
  27.     public function onPreUpdateEntity(): void
  28.     {
  29.         $this->updatedAt = new \DateTimeImmutable('now');
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getMagasin(): ?Magasin
  36.     {
  37.         return $this->magasin;
  38.     }
  39.     public function setMagasin(?Magasin $magasin): self
  40.     {
  41.         $this->magasin $magasin;
  42.         return $this;
  43.     }
  44.     // Sort est un json dans lequel sont stockées les pages dans l'ordre souhaité ainsi que des rubriques si souhaité.
  45.     // Ex format de data : [
  46.     //   {
  47.     //      "type":"page",
  48.     //      "custom":"2",
  49.     //      "id":"1ec6d49b-992d-6318-9eaa-f5385f4a5245",
  50.     //      "groupName":null,
  51.     //      "pages":null
  52.     //   },
  53.     //   {
  54.     //      "type":"page",
  55.     //      "custom":"2",
  56.     //      "id":"1ec6d49b-992d-67e6-8e4a-f5385f4a5245",
  57.     //      "groupName":null,
  58.     //      "pages":null
  59.     //   },
  60.     //   {
  61.     //      "type":"group", // type group pour la création d'une rubrique avec des sous pages
  62.     //      "custom":null,
  63.     //      "id":null,
  64.     //      "groupName":"Ma rubrique",
  65.     //      "pages":[
  66.     //         {
  67.     //            "type":"page",
  68.     //            "custom":"1",
  69.     //            "id":"87",
  70.     //            "pages":null
  71.     //         },
  72.     //         {
  73.     //            "type":"page",
  74.     //            "custom":"1",
  75.     //            "id":"62",
  76.     //            "pages":null
  77.     //         }
  78.     //      ]
  79.     //   },
  80.     //   {
  81.     //      "type":"page",
  82.     //      "custom":"2",
  83.     //      "id":"1ec6d49b-992d-65c0-8877-f5385f4a5245",
  84.     //      "groupName":null,
  85.     //      "pages":null
  86.     //   }
  87.     //]
  88.     public function getSort(): ?string
  89.     {
  90.         return $this->sort;
  91.     }
  92.     public function setSort(?string $sort): self
  93.     {
  94.         $this->sort $sort;
  95.         return $this;
  96.     }
  97.     public function getUpdatedAt(): ?\DateTimeImmutable
  98.     {
  99.         return $this->updatedAt;
  100.     }
  101.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  102.     {
  103.         $this->updatedAt $updatedAt;
  104.         return $this;
  105.     }
  106.     /**
  107.      * @return mixed
  108.      */
  109.     public function getLang()
  110.     {
  111.         return $this->lang;
  112.     }
  113.     public function setLang(mixed $lang): void
  114.     {
  115.         $this->lang $lang;
  116.     }
  117. }