src/Entity/Api/Event.php line 61

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Api;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Annotation\ApiFilter;
  6. use Symfony\Component\Serializer\Annotation\Groups
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  9. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  10. /**
  11.  * @ORM\Entity(repositoryClass="App\Repository\EventRepository")
  12.  * @ApiResource(
  13.  * collectionOperations={
  14.  * "get": {
  15.  *             "method": "GET",
  16.  *              "openapi_context": {
  17.  *                 "responses": {
  18.  *                     "200": {
  19.  *                         "description" : "Event collection",
  20.  *                         "content": {
  21.  *                            "application/json": {
  22.  *                                  "schema": {
  23.  *                                      "example" : "{""data"": [ { ""id"": 0, ""name"": ""string"", ""content"": ""string"", ""teaser"": ""string"", ""dateFrom"": ""2022-08-10T19:26:53.721Z"", ""dateTo"": ""2022-08-10T19:26:53.721Z"", ""urlLink"": ""string"", ""location"": ""string"", ""organizer"": ""string"", ""phone"": ""string"", ""email"": ""string"", ""published"": 0, ""slug"": ""string"", ""contactPerson"": ""string"", ""icon"": ""string"", ""category"": ""string"", ""site"": [ ""string"" ], ""statistic"": ""string"" } ], ""meta"": {""current_page"": 1,""from"": 0,""to"": 30,""per_page"": ""30"",""last_page"": 8,""total"": 211 }}",
  24.  *                                      "type": "object",
  25.  *                                      "properties" : {
  26.  *                                          "data" :  {
  27.  *                                              "type": "array",
  28.  *                                               "items": {
  29.  *                                                  "$ref":"#/components/schemas/Event"
  30.  *                                                  }
  31.  *                                              
  32.  *                                          },
  33.  *                                          "meta": {
  34.  *                                              "type": "object",
  35.  *                                              "properties": {
  36.  *                                                  "current_page":{"type": "integer"},
  37.  *                                                  "from":{"type": "integer"},
  38.  *                                                  "to":{"type": "integer"},
  39.  *                                                  "per_page":{"type": "integer"},
  40.  *                                                  "last_page":{"type": "integer"},
  41.  *                                                  "total":{"type": "integer"}
  42.  *                                                  } 
  43.  *                                             
  44.  *                                           }
  45.  *                                      }
  46.  *                                  }
  47.  *                              }
  48.  *                         },
  49.  *                     },
  50.  *                 },
  51.  *             },
  52.  *         },
  53.  * },
  54.  * itemOperations={"get"}
  55.  * )
  56.  * @ApiFilter(DateFilter::class, properties={"dateFrom"})
  57.  * @ApiFilter(SearchFilter::class, properties={"name":"partial", "slug":"exact","site":"exact"})
  58.  * @ApiFilter(OrderFilter::class, properties={"dateFrom"})
  59.  */
  60. class Event {
  61.     /**
  62.      * @ORM\Id
  63.      * @ORM\Column(type="integer")
  64.      * @ORM\GeneratedValue(strategy="AUTO")
  65.      */
  66.     protected $id;
  67.     /**
  68.      * @ORM\Column(type="string", length=200)
  69.      */
  70.     protected $name;
  71.     /**
  72.      * @ORM\Column(type="text", nullable = true)
  73.      */
  74.     protected $content;
  75.      /**
  76.      * @ORM\Column(type="text", nullable = true)
  77.      */
  78.     protected $teaser;
  79.     /**
  80.      * @ORM\Column(type="datetime", nullable=true)
  81.      */
  82.     protected $dateFrom;
  83.     /**
  84.      * @ORM\Column(type="datetime", nullable=true)
  85.      */
  86.     protected $dateTo;
  87.     /**
  88.      * @ORM\Column(type="string",length=1000, nullable=true)
  89.      */
  90.     protected $urlLink;
  91.     /**
  92.      * @ORM\Column(type="string",length=255, nullable=true)
  93.      */
  94.     protected $location;
  95.     /**
  96.      * @ORM\Column(type="string",length=255, nullable=true)
  97.      */
  98.     protected $organizer;
  99.     /**
  100.      * @ORM\Column(type="string",length=200, nullable=true)
  101.      */
  102.     protected $phone;
  103.     /**
  104.      * @ORM\Column(type="string",length=200, nullable=true)
  105.      */
  106.     protected $email;
  107.     /**
  108.      * @ORM\Column(type="integer", nullable=true)
  109.      */
  110.     protected $published;
  111.     /**
  112.      * @ORM\Column(type="string", length=255, nullable = true)
  113.      */
  114.     protected $slug;
  115.     /**
  116.      * @ORM\Column(type="string", length=255, nullable = true)
  117.      */
  118.     protected $contactPerson;
  119.     /**
  120.      * @ORM\Column(type="string", length=255, nullable = true)
  121.      */
  122.     protected $icon;
  123.      /**
  124.      * @ORM\Column(type="string", length=255, nullable = true)
  125.      */
  126.     protected $category;
  127.       /**
  128.      * @ORM\Column(type="array", nullable=true)
  129.      */
  130.     protected $site;
  131.     protected $statistic;
  132.     public function setId($id): self
  133.     {
  134.         $this->id $id;
  135.         return $this;
  136.     }
  137.     public function getId(): ?int
  138.     {
  139.         return $this->id;
  140.     }
  141.     public function getName(): ?string
  142.     {
  143.         return $this->name;
  144.     }
  145.     public function setName(string $name): self
  146.     {
  147.         $this->name $name;
  148.         return $this;
  149.     }
  150.     public function getContent(): ?string
  151.     {
  152.         return $this->content;
  153.     }
  154.     public function setContent(?string $content): self
  155.     {
  156.         $this->content $content;
  157.         return $this;
  158.     }
  159.     public function getTeaser(): ?string
  160.     {
  161.         return $this->teaser;
  162.     }
  163.     public function setTeaser(?string $teaser): self
  164.     {
  165.         $this->teaser $teaser;
  166.         return $this;
  167.     }
  168.     public function getDateFrom(): ?\DateTimeInterface
  169.     {
  170.         return $this->dateFrom;
  171.     }
  172.     public function setDateFrom(?\DateTimeInterface $date_from): self
  173.     {
  174.         $this->dateFrom $date_from;
  175.         return $this;
  176.     }
  177.     public function getDateTo(): ?\DateTimeInterface
  178.     {
  179.         return $this->dateTo;
  180.     }
  181.     public function setDateTo(?\DateTimeInterface $date_to): self
  182.     {
  183.         $this->dateTo $date_to;
  184.         return $this;
  185.     }
  186.     public function getUrlLink(): ?string
  187.     {
  188.         return $this->urlLink;
  189.     }
  190.     public function setUrlLink(?string $url_link): self
  191.     {
  192.         $this->urlLink $url_link;
  193.         return $this;
  194.     }
  195.     public function getLocation(): ?string
  196.     {
  197.         return $this->location;
  198.     }
  199.     public function setLocation(?string $location): self
  200.     {
  201.         $this->location $location;
  202.         return $this;
  203.     }
  204.     public function getOrganizer(): ?string
  205.     {
  206.         return $this->organizer;
  207.     }
  208.     public function setOrganizer(?string $organizer): self
  209.     {
  210.         $this->organizer $organizer;
  211.         return $this;
  212.     }
  213.     public function getPhone(): ?string
  214.     {
  215.         return $this->phone;
  216.     }
  217.     public function setPhone(?string $phone): self
  218.     {
  219.         $this->phone $phone;
  220.         return $this;
  221.     }
  222.     public function getEmail(): ?string
  223.     {
  224.         return $this->email;
  225.     }
  226.     public function setEmail(?string $email): self
  227.     {
  228.         $this->email $email;
  229.         return $this;
  230.     }
  231.     public function getPublished(): ?int
  232.     {
  233.         return $this->published;
  234.     }
  235.     public function setPublished(?int $published): self
  236.     {
  237.         $this->published $published;
  238.         return $this;
  239.     }
  240.     public function getSlug(): ?string
  241.     {
  242.         return $this->slug;
  243.     }
  244.     public function setSlug(?string $slug): self
  245.     {
  246.         $this->slug $slug;
  247.         return $this;
  248.     }
  249.     public function getContactPerson(): ?string
  250.     {
  251.         return $this->contactPerson;
  252.     }
  253.     public function setContactPerson(?string $contact_person): self
  254.     {
  255.         $this->contactPerson $contact_person;
  256.         return $this;
  257.     }
  258.     public function getIcon(): ?string
  259.     {
  260.         return $this->icon;
  261.     }
  262.     public function setIcon(?string $icon): self
  263.     {
  264.         $this->icon $icon;
  265.         return $this;
  266.     }
  267.     public function getCategory(): ?string
  268.     {
  269.         return $this->category;
  270.     }
  271.     public function setCategory(?string $category): self
  272.     {
  273.         $this->category $category;
  274.         return $this;
  275.     }
  276.     /**
  277.      * Get the value of site
  278.      */ 
  279.     public function getSite()
  280.     {
  281.         return $this->site;
  282.     }
  283.     /**
  284.      * Set the value of site
  285.      *
  286.      * @return  self
  287.      */ 
  288.     public function setSite($site)
  289.     {
  290.         $this->site $site;
  291.         return $this;
  292.     }
  293.     /**
  294.      * Get the value of statistic
  295.      */ 
  296.     public function getStatistic()
  297.     {
  298.         return $this->statistic;
  299.     }
  300.     /**
  301.      * Set the value of statistic
  302.      *
  303.      * @return  self
  304.      */ 
  305.     public function setStatistic($statistic)
  306.     {
  307.         $this->statistic $statistic;
  308.         return $this;
  309.     }
  310. }