<?php
namespace App\Entity\Api;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
/**
*
* @ORM\Entity(repositoryClass="App\Repository\ArticleRepository")
* @ApiResource(
* collectionOperations={
* "get": {
* "method": "GET",
* "openapi_context": {
* "responses": {
* "200": {
* "description" : "Article collection",
* "content": {
* "application/json": {
* "schema": {
* "example" : "{""data"": [{ ""id"": 0, ""name"": ""string"", ""icon"": ""string"", ""teaser"": ""string"", ""body"": ""string"", ""published"": 0, ""priority"": 0, ""author"": ""string"", ""publishedFrom"": ""2022-08-09T09:36:57.901Z"", ""publishedTo"": ""2022-08-09T09:36:57.901Z"", ""slug"": ""string"", ""seoTitle"": ""string"", ""metadata"": ""string"", ""category"": ""string"", ""site"": [ ""string"" ], ""lang"": ""string"", ""statistic"": ""string"" }], ""meta"": {""current_page"": 1,""from"": 0,""to"": 30,""per_page"": ""30"",""last_page"": 8,""total"": 211 }}",
* "type": "object",
* "properties" : {
* "data" : {
* "type": "array",
* "items": {
* "$ref":"#/components/schemas/Article"
* }
*
* },
* "meta": {
* "type": "object",
* "properties": {
* "current_page":{"type": "integer"},
* "from":{"type": "integer"},
* "to":{"type": "integer"},
* "per_page":{"type": "integer"},
* "last_page":{"type": "integer"},
* "total":{"type": "integer"}
* }
*
* }
* }
* }
* }
* },
* },
* },
* },
* },
* },
* itemOperations={"get"},
* graphql={}
*
* )
* @ApiFilter(SearchFilter::class, properties={"name":"partial", "category":"exact", "slug":"exact","site":"exact","published":"exact"})
* @ApiFilter(DateFilter::class, properties={"publishedFrom"})
* @ApiFilter(OrderFilter::class, properties={"publishedFrom","priority"})
*
*
*/
class Article {
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=500)
* @ApiFilter(SearchFilter::class)
*/
protected $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $icon;
/**
* @ORM\Column(type="text", length=2000, nullable=true)
*/
protected $teaser;
/**
* @ORM\Column(type="text", length=5000, nullable=true)
*/
protected $body;
/**
* @ORM\Column(type="integer")
*/
protected $published;
/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $priority;
/**
* @ORM\Column(type="string", length=200)
*/
protected $author;
/**
* @ORM\Column(type="datetime", name="published_from",nullable=true)
*/
private $publishedFrom;
/**
* @ORM\Column(type="datetime", name="published_to",nullable=true)
*/
private $publishedTo;
/**
* @ORM\Column(type="string")
*/
protected $slug;
/**
* @ORM\Column(type="string",name="seo_title", length=255, nullable=true)
*/
protected $seoTitle;
/**
* @ORM\Column(type="string",length=5000, nullable=true)
*/
protected $metadata;
/**
* @ORM\Column(type="string",length=5000, nullable=true)
*/
protected $search;
/**
* @ORM\Column(type="string",length=255, nullable=true)
*/
protected $category;
/**
* @ORM\Column(type="array", nullable=true)
* @ApiProperty(attributes={"openapi_context"={"enum":{"one", "two"}}})
*/
protected $site;
/**
* @ORM\Column(type="string", nullable=true)
* @ApiFilter(SearchFilter::class)
*/
protected $lang;
protected $statistic;
/**
* Get the value of id
*/
public function getId()
{
return $this->id;
}
/**
* Set the value of id
*
* @return self
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Get the value of name
*/
public function getName()
{
return $this->name;
}
/**
* Set the value of name
*
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get the value of icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Set the value of icon
*
* @return self
*/
public function setIcon($icon)
{
$this->icon = $icon;
return $this;
}
/**
* Get the value of teaser
*/
public function getTeaser()
{
return $this->teaser;
}
/**
* Set the value of teaser
*
* @return self
*/
public function setTeaser($teaser)
{
$this->teaser = $teaser;
return $this;
}
/**
* Get the value of body
*/
public function getBody()
{
return $this->body;
}
/**
* Set the value of body
*
* @return self
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
/**
* Get the value of published
*/
public function getPublished()
{
return $this->published;
}
/**
* Set the value of published
*
* @return self
*/
public function setPublished($published)
{
$this->published = $published;
return $this;
}
/**
* Get the value of priority
*/
public function getPriority()
{
return $this->priority;
}
/**
* Set the value of priority
*
* @return self
*/
public function setPriority($priority)
{
$this->priority = $priority;
return $this;
}
/**
* Get the value of author
*/
public function getAuthor()
{
return $this->author;
}
/**
* Set the value of author
*
* @return self
*/
public function setAuthor($author)
{
$this->author = $author;
return $this;
}
/**
* Get the value of publishedFrom
*/
public function getPublishedFrom()
{
return $this->publishedFrom;
}
/**
* Set the value of publishedFrom
*
* @return self
*/
public function setPublishedFrom($publishedFrom)
{
$this->publishedFrom = $publishedFrom;
return $this;
}
/**
* Get the value of publishedTo
*/
public function getPublishedTo()
{
return $this->publishedTo;
}
/**
* Set the value of publishedTo
*
* @return self
*/
public function setPublishedTo($publishedTo)
{
$this->publishedTo = $publishedTo;
return $this;
}
/**
* Get the value of slug
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set the value of slug
*
* @return self
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get the value of seoTitle
*/
public function getSeoTitle()
{
return $this->seoTitle;
}
/**
* Set the value of seoTitle
*
* @return self
*/
public function setSeoTitle($seoTitle)
{
$this->seoTitle = $seoTitle;
return $this;
}
/**
* Get the value of metadata
*/
public function getMetadata()
{
return $this->metadata;
}
/**
* Set the value of metadata
*
* @return self
*/
public function setMetadata($metadata)
{
$this->metadata = $metadata;
return $this;
}
/**
* Get the value of category
*/
public function getCategory()
{
return $this->category;
}
/**
* Set the value of category
*
* @return self
*/
public function setCategory($category)
{
$this->category = $category;
return $this;
}
/**
* Get the value of site
*/
public function getSite()
{
return $this->site;
}
/**
* Set the value of site
*
* @return self
*/
public function setSite($site)
{
$this->site = $site;
return $this;
}
/**
* Get the value of statistic
*/
public function getStatistic()
{
return $this->statistic;
}
/**
* Set the value of statistic
*
* @return self
*/
public function setStatistic($statistic)
{
$this->statistic = $statistic;
return $this;
}
/**
* Get the value of lang
*/
public function getLang()
{
return $this->lang;
}
/**
* Set the value of lang
*
* @return self
*/
public function setLang($lang)
{
$this->lang = $lang;
return $this;
}
}