src/Entity/Studio.php line 67

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Doctrine\Orm\Filter\ExistsFilter;
  4. use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  5. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  6. use ApiPlatform\Metadata\ApiFilter;
  7. use ApiPlatform\Metadata\ApiResource;
  8. use ApiPlatform\Metadata\Get;
  9. use ApiPlatform\Metadata\GetCollection;
  10. use ApiPlatform\Metadata\Patch;
  11. use ApiPlatform\Metadata\Post;
  12. use ApiPlatform\Metadata\Put;
  13. use ApiPlatform\Serializer\Filter\PropertyFilter;
  14. use App\Repository\StudioRepository;
  15. use DateTimeImmutable;
  16. use Doctrine\Common\Collections\ArrayCollection;
  17. use Doctrine\Common\Collections\Collection;
  18. use Doctrine\DBAL\Types\Types;
  19. use Doctrine\ORM\Mapping as ORM;
  20. use Doctrine\ORM\Mapping\OrderBy;
  21. use Symfony\Component\HttpFoundation\Request;
  22. use Symfony\Component\Serializer\Annotation\Groups;
  23. #[ORM\Entity(repositoryClassStudioRepository::class)]
  24. #[ApiFilter(PropertyFilter::class)]
  25. #[ApiResource(
  26.     shortName'Studio',
  27.     description'Studio API',
  28.     operations: [
  29.         new Get(uriTemplate'/studio/{id}'),
  30.        // new POST(uriTemplate: '/studio/{id}',security: "is_granted('ROLE_OAUTH2_BASIC')"),
  31.         new GetCollection(uriTemplate'/studio'paginationEnabledfalse),
  32.         new Patch(uriTemplate'/studio/{id}',security"is_granted('ROLE_OAUTH2_BASIC')"),
  33.     ],
  34.     //,security: "is_granted('ROLE_OAUTH2_BASIC')"
  35.     formats: [
  36.         'jsonld',
  37.         'json',
  38.         'jsonhal',
  39.         'csv' => 'text/csv',
  40.     ],
  41.     normalizationContext: [
  42.         'groups' => ['studio:read'],
  43.     ],
  44.     denormalizationContext: [
  45.         'groups' => ['studio:write'],
  46.     ],
  47.     // paginationItemsPerPage: 10,
  48. ),
  49.     ApiFilter(
  50.         OrderFilter::class,
  51.         properties: [
  52.             'position',
  53.             'createdAt'
  54.         ],
  55.     ),
  56.     ApiFilter(
  57.         ExistsFilter::class,
  58.         properties: [
  59.             'siteSeo',
  60.         ],
  61.     ),
  62. ]
  63. class Studio
  64. {
  65.     #[ORM\Id]
  66.     #[ORM\GeneratedValue]
  67.     #[ORM\Column]
  68.     #[Groups(['studio:read','news:read','seo:read'])]
  69.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  70.     private ?int $id null;
  71.     #[ORM\Column(length64)]
  72.     #[Groups(['studio:read','news:read','seo:read'])]
  73.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  74.     private ?string $bezeichnung null;
  75.     #[ORM\Column(length64)]
  76.     #[Groups(['studio:read','news:read''seo:read'])]
  77.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  78.     private ?string $slug null;
  79.     #[ORM\Column(typeTypes::SMALLINT)]
  80.     #[Groups(['studio:read','news:read'])]
  81.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  82.     private ?int $inPlanung null;
  83.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  84.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  85.     #[Groups(['studio:read','news:read'])]
  86.     private ?int $geschlossen null;
  87.     #[ORM\ManyToOne(inversedBy'studio')]
  88.     #[ORM\JoinColumn(nullabletrue)]
  89.     //  #[ORM\JoinColumn(name: 'id',referencedColumnName: 'franchise_nehmer_id', nullable: true)]
  90.     protected ?FranchiseNehmer $franchiseNehmer;
  91.     #[ORM\OneToOne(inversedBy"studio"targetEntityGeoData::class, cascade: ["persist""remove"])]
  92.     #[ORM\JoinColumn(name"geodaten"nullabletrue)]
  93.     #[Groups(['studio:read'])]
  94.     protected ?GeoData $geodaten;
  95.     #[ORM\OneToOne(inversedBy"studio"targetEntityStudioContent::class, cascade: ["persist""remove"])]
  96.     #[ORM\JoinColumn(name"studioContent"nullabletrue)]
  97.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  98.     #[Groups(['studio:read'])]
  99.     protected ?StudioContent $studioContent;
  100.     #[ORM\OneToOne(inversedBy"studio"targetEntityStudioZeiten::class, cascade: ["persist""remove"])]
  101.     #[ORM\JoinColumn(name"zeiten"nullabletrue)]
  102.     protected ?StudioZeiten $zeiten;
  103.     #[ORM\OneToOne(inversedBy"studio"targetEntitySaunaZeiten::class, cascade: ["persist""remove"])]
  104.     #[ORM\JoinColumn(name"saunaZeiten"nullabletrue)]
  105.     protected ?SaunaZeiten $saunazeiten;
  106.     #[ORM\OneToOne(inversedBy"studio"targetEntityAccessZeiten::class, cascade: ["persist""remove"])]
  107.     #[ORM\JoinColumn(name"accessZeiten"nullabletrue)]
  108.     protected ?AccessZeiten $accesszeiten;
  109.     #[ORM\OneToOne(inversedBy"studio"targetEntitySupportZeiten::class, cascade: ["persist""remove"])]
  110.     #[ORM\JoinColumn(name"supportZeiten"nullabletrue)]
  111.     protected ?SupportZeiten $supportZeiten;
  112.     #[ORM\OneToOne(inversedBy"studio"targetEntityOpeningTimes::class, cascade: ["persist""remove"])]
  113.     #[ORM\JoinColumn(name"openingTimes"nullabletrue)]
  114.     protected ?OpeningTimes $openingTimes;
  115.     #[ORM\OneToOne(inversedBy"studio"targetEntitySiteSeo::class, cascade: ["persist""remove"])]
  116.     #[ORM\JoinColumn(name"siteSeo"nullabletrue)]
  117.     #[Groups(['seo:read''seo:write','studio:write'])]
  118.     protected ?SiteSeo $siteSeo;
  119.     #[ORM\OneToOne(inversedBy"studio"targetEntityStudioKurse::class, cascade: ["persist""remove"])]
  120.     #[ORM\JoinColumn(name"studioKurse"nullabletrue)]
  121.     //#[Groups(['studio:read'])]
  122.     protected ?StudioKurse $studioKurse;
  123.     // #[ORM\OneToMany(mappedBy: 'studio', targetEntity: Mediathek::class, cascade: ["persist"], orphanRemoval: true)]
  124.     //#[Groups(['studio:read'])]
  125.     // public Collection $mediathek;
  126.     #[ORM\OneToMany(mappedBy'studio'targetEntityStudioVideo::class, cascade: ["persist"], orphanRemovaltrue)]
  127.     #[Groups(['studio:read'])]
  128.     public Collection $studioVideo;
  129.     #[ORM\OneToMany(mappedBy'studio'targetEntityStudioMedia::class, cascade: ["persist"], orphanRemovaltrue)]
  130.     #[Groups(['studio:read''seo:read'])]
  131.     #[OrderBy(['position' => 'ASC'])]
  132.     protected Collection $studioMedia;
  133.     #[Groups(['studio:read'])]
  134.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  135.     #[ORM\OneToMany(mappedBy'studio'targetEntityNews::class, cascade: ["persist"], orphanRemovaltrue)]
  136.     protected Collection $news;
  137.     #[ORM\Column]
  138.     private ?DateTimeImmutable $createdAt null;
  139.     #[ORM\Column(length128nullabletrue)]
  140.     #[Groups(['studio:read'])]
  141.     private ?string $website null;
  142.     #[ORM\Column(length32nullabletrue)]
  143.     #[Groups(['studio:read'])]
  144.     private ?string $telefon null;
  145.     #[ORM\Column(length32nullabletrue)]
  146.     #[Groups(['studio:read'])]
  147.     private ?string $mobil null;
  148.     #[ORM\Column(length32nullabletrue)]
  149.     #[Groups(['studio:read'])]
  150.     private ?string $fax null;
  151.     #[ORM\Column(length8nullabletrue)]
  152.     #[Groups(['studio:read'])]
  153.     private ?string $plz null;
  154.     #[ORM\Column(length64nullabletrue)]
  155.     #[Groups(['studio:read'])]
  156.     private ?string $ort null;
  157.     #[ORM\Column(length128nullabletrue)]
  158.     #[Groups(['studio:read'])]
  159.     private ?string $strasse null;
  160.     #[ORM\Column(length64nullabletrue)]
  161.     #[Groups(['studio:read'])]
  162.     private ?string $email null;
  163.     #[ORM\Column(nullabletrueoptions: ['default' => 0])]
  164.     #[Groups(['studio:read'])]
  165.     private ?int $position null;
  166.     #[ORM\Column(nullabletrue)]
  167.     private array $leistungen = [];
  168.     public function __construct(
  169.     )
  170.     {
  171.         $this->createdAt = new DateTimeImmutable();
  172.         $this->studioVideo = new ArrayCollection();
  173.         $this->studioMedia = new ArrayCollection();
  174.         $this->leistungen = [];
  175.         $this->position 0;
  176.         $this->news = new ArrayCollection();
  177.         $this->siteSeo NULL;
  178.     }
  179.     public function getId(): ?int
  180.     {
  181.         return $this->id;
  182.     }
  183.     public function getBezeichnung(): ?string
  184.     {
  185.         return $this->bezeichnung;
  186.     }
  187.     public function setBezeichnung(string $bezeichnung): self
  188.     {
  189.         $this->bezeichnung $bezeichnung;
  190.         return $this;
  191.     }
  192.     public function getSlug(): ?string
  193.     {
  194.         return $this->slug;
  195.     }
  196.     public function setSlug(string $slug): self
  197.     {
  198.         $this->slug $slug;
  199.         return $this;
  200.     }
  201.     public function getInPlanung(): ?int
  202.     {
  203.         return $this->inPlanung;
  204.     }
  205.     public function setInPlanung(int $inPlanung): self
  206.     {
  207.         $this->inPlanung $inPlanung;
  208.         return $this;
  209.     }
  210.     public function getGeschlossen(): ?int
  211.     {
  212.         return $this->geschlossen;
  213.     }
  214.     public function setGeschlossen(int $geschlossen): self
  215.     {
  216.         $this->geschlossen $geschlossen;
  217.         return $this;
  218.     }
  219.     public function getCreatedAt(): ?DateTimeImmutable
  220.     {
  221.         return $this->createdAt;
  222.     }
  223.     public function setCreatedAt(DateTimeImmutable $createdAt): self
  224.     {
  225.         $this->createdAt $createdAt;
  226.         return $this;
  227.     }
  228.     #[Groups(['seo:read''studio:read'])]
  229.     public function getOrderCreatedAt(): ?DateTimeImmutable
  230.     {
  231.         return $this->createdAt;
  232.     }
  233.     public function getFranchiseNehmer(): ?FranchiseNehmer
  234.     {
  235.         return $this->franchiseNehmer;
  236.     }
  237.     public function setFranchiseNehmer(?FranchiseNehmer $franchiseNehmer): self
  238.     {
  239.         $this->franchiseNehmer $franchiseNehmer;
  240.         return $this;
  241.     }
  242.     public function getWebsite(): ?string
  243.     {
  244.         return $this->website;
  245.     }
  246.     public function setWebsite(?string $website): self
  247.     {
  248.         $this->website $website;
  249.         return $this;
  250.     }
  251.     public function getTelefon(): ?string
  252.     {
  253.         return $this->telefon;
  254.     }
  255.     public function setTelefon(?string $telefon): self
  256.     {
  257.         $this->telefon $telefon;
  258.         return $this;
  259.     }
  260.     public function getMobil(): ?string
  261.     {
  262.         return $this->mobil;
  263.     }
  264.     public function setMobil(?string $mobil): self
  265.     {
  266.         $this->mobil $mobil;
  267.         return $this;
  268.     }
  269.     public function getFax(): ?string
  270.     {
  271.         return $this->fax;
  272.     }
  273.     public function setFax(?string $fax): self
  274.     {
  275.         $this->fax $fax;
  276.         return $this;
  277.     }
  278.     public function getPlz(): ?string
  279.     {
  280.         return $this->plz;
  281.     }
  282.     public function setPlz(?string $plz): self
  283.     {
  284.         $this->plz $plz;
  285.         return $this;
  286.     }
  287.     public function getOrt(): ?string
  288.     {
  289.         return $this->ort;
  290.     }
  291.     public function setOrt(?string $ort): self
  292.     {
  293.         $this->ort $ort;
  294.         return $this;
  295.     }
  296.     public function getStrasse(): ?string
  297.     {
  298.         return $this->strasse;
  299.     }
  300.     public function setStrasse(?string $strasse): self
  301.     {
  302.         $this->strasse $strasse;
  303.         return $this;
  304.     }
  305.     public function getEmail(): ?string
  306.     {
  307.         return $this->email;
  308.     }
  309.     public function setEmail(?string $email): self
  310.     {
  311.         $this->email $email;
  312.         return $this;
  313.     }
  314.     public function getGeodaten(): ?GeoData
  315.     {
  316.         return $this->geodaten;
  317.     }
  318.     public function setGeodaten(?GeoData $geodaten): self
  319.     {
  320.         $this->geodaten $geodaten;
  321.         return $this;
  322.     }
  323.     public function getZeiten(): ?StudioZeiten
  324.     {
  325.         return $this->zeiten;
  326.     }
  327.     public function setZeiten(?StudioZeiten $zeiten): self
  328.     {
  329.         $this->zeiten $zeiten;
  330.         return $this;
  331.     }
  332.     #[Groups(['studio:read'])]
  333.     public function getSaunaZeiten(): ?SaunaZeiten
  334.     {
  335.         return $this->saunazeiten;
  336.     }
  337.     public function setSaunaZeiten(?SaunaZeiten $saunazeiten): self
  338.     {
  339.         $this->saunazeiten $saunazeiten;
  340.         return $this;
  341.     }
  342.     #[Groups(['studio:read'])]
  343.     public function getAccessZeiten(): ?AccessZeiten
  344.     {
  345.         return $this->accesszeiten;
  346.     }
  347.     public function setAccessZeiten(?AccessZeiten $accesszeiten): self
  348.     {
  349.         $this->accesszeiten $accesszeiten;
  350.         return $this;
  351.     }
  352.     #[Groups(['studio:read'])]
  353.     public function getSupportZeiten(): ?SupportZeiten
  354.     {
  355.         return $this->supportZeiten;
  356.     }
  357.     public function setSupportZeiten(?SupportZeiten $supportZeiten): self
  358.     {
  359.         $this->supportZeiten $supportZeiten;
  360.         return $this;
  361.     }
  362.     #[Groups(['studio:read'])]
  363.     public function getOpeningTimes(): ?OpeningTimes
  364.     {
  365.         return $this->openingTimes;
  366.     }
  367.     public function setOpeningTimes(?OpeningTimes $openingTimes): self
  368.     {
  369.         $this->openingTimes $openingTimes;
  370.         return $this;
  371.     }
  372.     #[Groups(['studio:read'])]
  373.     public function getSiteSeo(): ?SiteSeo
  374.     {
  375.         return $this->siteSeo;
  376.     }
  377.     public function setSiteSeo(?SiteSeo $siteSeo): self
  378.     {
  379.         $this->siteSeo $siteSeo;
  380.         return $this;
  381.     }
  382.     /**
  383.      * @return Collection<int, StudioVideo>
  384.      */
  385.     public function getStudioVideo(): Collection
  386.     {
  387.         return $this->studioVideo;
  388.     }
  389.     public function addStudioVideo(StudioVideo $studioVideo): self
  390.     {
  391.         if (!$this->studioVideo->contains($studioVideo)) {
  392.             $this->studioVideo->add($studioVideo);
  393.             $studioVideo->setStudio($this);
  394.         }
  395.         return $this;
  396.     }
  397.     public function removeStudioVideo(StudioVideo $studioVideo): self
  398.     {
  399.         if ($this->studioVideo->removeElement($studioVideo)) {
  400.             // set the owning side to null (unless already changed)
  401.             if ($studioVideo->getStudio() === $this) {
  402.                 $studioVideo->setStudio(null);
  403.             }
  404.         }
  405.         return $this;
  406.     }
  407.     /**
  408.      * @return Collection<int, StudioMedia>
  409.      */
  410.     public function getStudioMedia(): Collection
  411.     {
  412.         return $this->studioMedia;
  413.     }
  414.     public function addStudioMedium(StudioMedia $studioMedium): self
  415.     {
  416.         if (!$this->studioMedia->contains($studioMedium)) {
  417.             $this->studioMedia->add($studioMedium);
  418.             $studioMedium->setStudio($this);
  419.         }
  420.         return $this;
  421.     }
  422.     public function removeStudioMedium(StudioMedia $studioMedium): self
  423.     {
  424.         if ($this->studioMedia->removeElement($studioMedium)) {
  425.             // set the owning side to null (unless already changed)
  426.             if ($studioMedium->getStudio() === $this) {
  427.                 $studioMedium->setStudio(null);
  428.             }
  429.         }
  430.         return $this;
  431.     }
  432.     public function getPosition(): ?int
  433.     {
  434.         return $this->position;
  435.     }
  436.     public function setPosition(?int $position): self
  437.     {
  438.         $this->position $position;
  439.         return $this;
  440.     }
  441.     // #[Groups(['studio:read'])]
  442.     public function getLogo(): ?array
  443.     {
  444.         $data = [];
  445.         $request Request::createFromGlobals();
  446.         $selfUrl $request->getSchemeAndHttpHost();
  447.         foreach ($this->studioMedia as $tmp) {
  448.             if ($tmp->getHandle() == 'studio-logo') {
  449.                 if ($tmp->getType() == 'image') {
  450.                     $full '/uploads/full/';
  451.                     $large '/uploads/large/';
  452.                     $medium '/uploads/medium/';
  453.                     $thumb '/uploads/thumb/';
  454.                 } else {
  455.                     $full '/uploads/data/';
  456.                     $large '/uploads/data/';
  457.                     $medium '/uploads/data/';
  458.                     $thumb '/uploads/data/';
  459.                 }
  460.                 $data = [
  461.                     'id' => $tmp->getId(),
  462.                     'filename' => $tmp->getFilename(),
  463.                     'original' => $tmp->getOriginal(),
  464.                     'title' => $tmp->getTitle(),
  465.                     'alt' => $tmp->getAlt(),
  466.                     'description' => $tmp->getDescription(),
  467.                     'custom' => $tmp->getCustom(),
  468.                     'self_url' => $selfUrl,
  469.                     'size' => $tmp->getSize(),
  470.                     'mimeType' => $tmp->getMimeType(),
  471.                     'variant' => [
  472.                         'full' => $full,
  473.                         'large' => $large,
  474.                         'medium' => $medium,
  475.                         'thumb' => $thumb
  476.                     ],
  477.                 ];
  478.             }
  479.         }
  480.         return [$data];
  481.     }
  482.     // #[Groups(['studio:read'])]
  483.     public function getTitleImage(): ?array
  484.     {
  485.         $data = [];
  486.         $request Request::createFromGlobals();
  487.         $selfUrl $request->getSchemeAndHttpHost();
  488.         foreach ($this->studioMedia as $tmp) {
  489.             if ($tmp->getHandle() == 'studio-titel') {
  490.                 if ($tmp->getType() == 'image') {
  491.                     $full '/uploads/full/';
  492.                     $large '/uploads/large/';
  493.                     $medium '/uploads/medium/';
  494.                     $thumb '/uploads/thumb/';
  495.                 } else {
  496.                     $full '/uploads/data/';
  497.                     $large '/uploads/data/';
  498.                     $medium '/uploads/data/';
  499.                     $thumb '/uploads/data/';
  500.                 }
  501.                 $data = [
  502.                     'id' => $tmp->getId(),
  503.                     'filename' => $tmp->getFilename(),
  504.                     'original' => $tmp->getOriginal(),
  505.                     'title' => $tmp->getTitle(),
  506.                     'alt' => $tmp->getAlt(),
  507.                     'description' => $tmp->getDescription(),
  508.                     'custom' => $tmp->getCustom(),
  509.                     'self_url' => $selfUrl,
  510.                     'size' => $tmp->getSize(),
  511.                     'mimeType' => $tmp->getMimeType(),
  512.                     'variant' => [
  513.                         'full' => $full,
  514.                         'large' => $large,
  515.                         'medium' => $medium,
  516.                         'thumb' => $thumb
  517.                     ],
  518.                 ];
  519.             }
  520.         }
  521.         return [$data];
  522.     }
  523.     // #[Groups(['studio:read'])]
  524.     public function getGalerie(): ?array
  525.     {
  526.         $a = [];
  527.         $request Request::createFromGlobals();
  528.         $selfUrl $request->getSchemeAndHttpHost();
  529.         foreach ($this->studioMedia as $tmp) {
  530.             if ($tmp->getHandle() == 'studio-galerie') {
  531.                 if ($tmp->getType() == 'image') {
  532.                     $full '/uploads/full/';
  533.                     $large '/uploads/large/';
  534.                     $medium '/uploads/medium/';
  535.                     $thumb '/uploads/thumb/';
  536.                 } else {
  537.                     $full '/uploads/data/';
  538.                     $large '/uploads/data/';
  539.                     $medium '/uploads/data/';
  540.                     $thumb '/uploads/data/';
  541.                 }
  542.                 $i = [
  543.                     'id' => $tmp->getId(),
  544.                     'filename' => $tmp->getFilename(),
  545.                     'original' => $tmp->getOriginal(),
  546.                     'title' => $tmp->getTitle(),
  547.                     'alt' => $tmp->getAlt(),
  548.                     'description' => $tmp->getDescription(),
  549.                     'custom' => $tmp->getCustom(),
  550.                     'self_url' => $selfUrl,
  551.                     'size' => $tmp->getSize(),
  552.                     'mimeType' => $tmp->getMimeType(),
  553.                     'variant' => [
  554.                         'full' => $full,
  555.                         'large' => $large,
  556.                         'medium' => $medium,
  557.                         'thumb' => $thumb
  558.                     ],
  559.                 ];
  560.                 $a[] = $i;
  561.             }
  562.         }
  563.         return [$a];
  564.     }
  565.     //  #[Groups(['studio:read'])]
  566.     public function getVideo(): ?array
  567.     {
  568.         $map $this->studioVideo;
  569.         $t = [];
  570.         foreach ($map as $tmp) {
  571.             $item = [
  572.                 'filename' => $tmp->getFilename(),
  573.                 'cover' => $tmp->getCoverImg(),
  574.                 'mime_type' => $tmp->getMimeType(),
  575.                 'size' => $tmp->getFileSizeConvert()
  576.             ];
  577.             $t[] = $item;
  578.         }
  579.         return [$t];
  580.     }
  581.     //  #[Groups(['studio:read'])]
  582.     public function getStudioZeiten(): ?array
  583.     {
  584.         if ($this->zeiten) {
  585.             $montag $this->zeiten->getMontag();
  586.             $montag json_decode($montag['data'], true);
  587.             $montag['closed'] ? $montagZeiten = [] : $montagZeiten $montag['zeiten'];
  588.             $dienstag $this->zeiten->getDienstag();
  589.             $dienstag json_decode($dienstag['data'], true);
  590.             $dienstag['closed'] ? $dienstagZeiten = [] : $dienstagZeiten $dienstag['zeiten'];
  591.             $mittwoch $this->zeiten->getMittwoch();
  592.             $mittwoch json_decode($mittwoch['data'], true);
  593.             $mittwoch['closed'] ? $mittwochZeiten = [] : $mittwochZeiten $mittwoch['zeiten'];
  594.             $donnerstag $this->zeiten->getDonnerstag();
  595.             $donnerstag json_decode($donnerstag['data'], true);
  596.             $donnerstag['closed'] ? $donnerstagZeiten = [] : $donnerstagZeiten $donnerstag['zeiten'];
  597.             $freitag $this->zeiten->getFreitag();
  598.             $freitag json_decode($freitag['data'], true);
  599.             $freitag['closed'] ? $freitagZeiten = [] : $freitagZeiten $freitag['zeiten'];
  600.             $samstag $this->zeiten->getSamstag();
  601.             $samstag json_decode($samstag['data'], true);
  602.             $samstag['closed'] ? $samstagZeiten = [] : $samstagZeiten $samstag['zeiten'];
  603.             $sonntag $this->zeiten->getSonntag();
  604.             $sonntag json_decode($sonntag['data'], true);
  605.             $sonntag['closed'] ? $sonntagZeiten = [] : $sonntagZeiten $sonntag['zeiten'];
  606.             return [
  607.                 'open247' => $this->zeiten->isOpen247(),
  608.                 'extraInfo' => $this->zeiten->getInfo(),
  609.                 'montag' => [
  610.                     'bezeichnung' => $montag['bezeichnung'],
  611.                     'closed' => $montag['closed'],
  612.                     'zeiten' => $montagZeiten
  613.                 ],
  614.                 'dienstag' => [
  615.                     'bezeichnung' => $dienstag['bezeichnung'],
  616.                     'closed' => $dienstag['closed'],
  617.                     'zeiten' => $dienstagZeiten
  618.                 ],
  619.                 'mittwoch' => [
  620.                     'bezeichnung' => $mittwoch['bezeichnung'],
  621.                     'closed' => $mittwoch['closed'],
  622.                     'zeiten' => $mittwochZeiten
  623.                 ],
  624.                 'donnerstag' => [
  625.                     'bezeichnung' => $donnerstag['bezeichnung'],
  626.                     'closed' => $donnerstag['closed'],
  627.                     'zeiten' => $donnerstagZeiten
  628.                 ],
  629.                 'freitag' => [
  630.                     'bezeichnung' => $freitag['bezeichnung'],
  631.                     'closed' => $freitag['closed'],
  632.                     'zeiten' => $freitagZeiten
  633.                 ],
  634.                 'samstag' => [
  635.                     'bezeichnung' => $samstag['bezeichnung'],
  636.                     'closed' => $samstag['closed'],
  637.                     'zeiten' => $samstagZeiten
  638.                 ],
  639.                 'sonntag' => [
  640.                     'bezeichnung' => $sonntag['bezeichnung'],
  641.                     'closed' => $sonntag['closed'],
  642.                     'zeiten' => $sonntagZeiten
  643.                 ],
  644.             ];
  645.         }
  646.         return [];
  647.     }
  648.     // #[Groups(['studio:read'])]
  649.     public function getStudioGeo(): array
  650.     {
  651.         if ($this->geodaten) {
  652.             $geoJson $this->geodaten->getGeoJson();
  653.             if ($geoJson) {
  654.                 $geoJson json_decode($geoJson['data'], true);
  655.             }
  656.             $boundingBox $this->geodaten->getBoundingBox();
  657.             if ($boundingBox) {
  658.                 $boundingBox json_decode($boundingBox['data'], true);
  659.             }
  660.             return [
  661.                 'id' => $this->geodaten->getId(),
  662.                 'osm_id' => $this->geodaten->getOsmId(),
  663.                 'place_id' => $this->geodaten->getPlaceId(),
  664.                 'display_name' => $this->geodaten->getDisplayName(),
  665.                 'importance' => $this->geodaten->getImportance(),
  666.                 'lon' => $this->geodaten->getGeoLon(),
  667.                 'lat' => $this->geodaten->getGeoLat(),
  668.                 'polygon' => $geoJson,
  669.                 'bounding_box' => $boundingBox,
  670.             ];
  671.         }
  672.         return [];
  673.     }
  674.     /**
  675.      * @return Collection<int, News>
  676.      */
  677.     public function getNews(): Collection
  678.     {
  679.         return $this->news;
  680.     }
  681.     public function addNews(News $news): self
  682.     {
  683.         if (!$this->news->contains($news)) {
  684.             $this->news->add($news);
  685.             $news->setStudio($this);
  686.         }
  687.         return $this;
  688.     }
  689.     public function removeNews(News $news): self
  690.     {
  691.         if ($this->news->removeElement($news)) {
  692.             // set the owning side to null (unless already changed)
  693.             if ($news->getStudio() === $this) {
  694.                 $news->setStudio(null);
  695.             }
  696.         }
  697.         return $this;
  698.     }
  699.     public function setStudioContent(?StudioContent $studioContent): self
  700.     {
  701.         $this->studioContent $studioContent;
  702.         return $this;
  703.     }
  704.     public function getStudioContent(): ?StudioContent
  705.     {
  706.         return $this->studioContent;
  707.     }
  708.    // #[Groups(['studio:read','content:read'])]
  709.     public function getStudioImpressum(): string
  710.     {
  711.         $impressum $this->studioContent;
  712.         $impressum->getImpressum();
  713.         return $impressum->getImpressum();
  714.     }
  715.     public function getStudioKurse(): ?StudioKurse
  716.     {
  717.         return $this->studioKurse;
  718.     }
  719.     public function setStudioKurse(?StudioKurse $studioKurse): self
  720.     {
  721.         $this->studioKurse $studioKurse;
  722.         return $this;
  723.     }
  724.     public function getLeistungen(): array
  725.     {
  726.         return $this->leistungen;
  727.     }
  728.     public function setLeistungen(?array $leistungen): self
  729.     {
  730.         $this->leistungen $leistungen;
  731.         return $this;
  732.     }
  733.     #[Groups(['studio:read'])]
  734.     public function getStudioLeistungen(): array
  735.     {
  736.         $request Request::createFromGlobals();
  737.         $selfUrl $request->getSchemeAndHttpHost();
  738.         $leistungArr = [];
  739.         if ($this->getLeistungen()) {
  740.             $leistungen json_decode($this->leistungen['data'], true);
  741.             $id '';
  742.             $title '';
  743.             $description =  '';
  744.             $color =  '';
  745.             $position '';
  746.             foreach ($leistungen as $tmp) {
  747.                 if(isset($tmp['category'])){
  748.                     $id $tmp['category']['id'];
  749.                     $title $tmp['category']['title'];
  750.                     $description $tmp['category']['description'];
  751.                     $color $tmp['category']['color'];
  752.                     $position $tmp['category']['position'];
  753.                 }
  754.                 $item = [
  755.                     'id' => $tmp['id'],
  756.                     'url' => '/api/leistung/' $tmp['id'],
  757.                     'title' => $tmp['title'] ?? '',
  758.                     'description' => $tmp['description'] ?? '',
  759.                     'preis' => $tmp['preis'] ?? '',
  760.                     'position' => $tmp['position'] ?? '',
  761.                     'inklusiv' => $tmp['inklusiv'] ?? '',
  762.                     'sonstiges' => $tmp['sonstiges'] ?? '',
  763.                     'icon_img' => $tmp['icon_img'] ?? '',
  764.                     'icon_img_type' => $tmp['icon_img_type'] ?? '',
  765.                     'leistung_img' => $tmp['leistung_img'] ?? '',
  766.                     'leistung_img_type' => $tmp['leistung_img_type'] ?? '',
  767.                     'category' => [
  768.                         'id' => $id,
  769.                         'title' => $title,
  770.                         'description' => $description,
  771.                         'color' => $color,
  772.                         'position' => $position,
  773.                     ],
  774.                 ];
  775.                 $leistungArr[] = $item;
  776.             }
  777.         }
  778.         return [
  779.             'self' => $selfUrl,
  780.             'data' => $leistungArr
  781.         ];
  782.     }
  783.     #[Groups(['studio:read'])]
  784.     public function getKurse(): ?array
  785.     {
  786.         if ($this->studioKurse) {
  787.             $montag json_decode($this->studioKurse->getMontag()['data'], true) ?? [];
  788.             $dienstag json_decode($this->studioKurse->getDienstag()['data'], true) ?? [];
  789.             $mittwoch json_decode($this->studioKurse->getMittwoch()['data'], true) ?? [];
  790.             $donnerstag json_decode($this->studioKurse->getDonnerstag()['data'], true) ?? [];
  791.             $freitag json_decode($this->studioKurse->getFreitag()['data'], true) ?? [];
  792.             $samstag json_decode($this->studioKurse->getSamstag()['data'], true) ?? [];
  793.             $sonntag json_decode($this->studioKurse->getSonntag()['data'], true) ?? [];
  794.             return [
  795.                 'montag' => $montag,
  796.                 'dienstag' => $dienstag,
  797.                 'mittwoch' => $mittwoch,
  798.                 'donnerstag' => $donnerstag,
  799.                 'freitag' => $freitag,
  800.                 'samstag' => $samstag,
  801.                 'sonntag' => $sonntag
  802.             ];
  803.         }
  804.         return [];
  805.     }
  806. }