<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\SexualOrientationRepository")
* @ORM\HasLifecycleCallbacks()
*/
#[ApiResource(collectionOperations: ['get', 'post'], itemOperations: ['get', 'put'])]
#[ApiFilter(PropertyFilter::class)]
#[ApiFilter(SearchFilter::class, properties: ['id', 'name' => 'partial'])]
#[ApiFilter(OrderFilter::class, properties: ['id', 'name'], arguments: ['orderParameterName' => 'order'])]
class SexualOrientation
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=128)
* @Assert\NotBlank()
* @Assert\Length(max=128)
*/
private $name;
/**
* @var string
*
* @ORM\Column(type="string", length=128)
* @Gedmo\Slug(fields={"name"})
*/
private $slug;
/**
* @var bool
*
* @ORM\Column(type="boolean")
* @Assert\Type(type="boolean")
*/
private $other;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function __toString(): string
{
return $this->getName();
}
public function getOther(): ?bool
{
return $this->other;
}
public function setOther(bool $other): self
{
$this->other = $other;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
}