src/Entity/EmployeesRange.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  7. use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Gedmo\Timestampable\Traits\TimestampableEntity;
  11. /**
  12.  * @ORM\Entity(repositoryClass="App\Repository\EmployeesRangeRepository")
  13.  * @ORM\HasLifecycleCallbacks()
  14.  */
  15. #[ApiResource]
  16. #[ApiFilter(PropertyFilter::class)]
  17. #[ApiFilter(SearchFilter::class, properties: ['id''name' => 'partial''position' => 'exact'])]
  18. #[ApiFilter(OrderFilter::class, properties: ['id''name''position'], arguments: ['orderParameterName' => 'order'])]
  19. class EmployeesRange
  20. {
  21.     use TimestampableEntity;
  22.     /**
  23.      * @ORM\Id()
  24.      * @ORM\GeneratedValue()
  25.      * @ORM\Column(type="integer")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\Column(type="string", length=128)
  30.      */
  31.     private $name;
  32.     /**
  33.      * @var int
  34.      *
  35.      * @ORM\Column(type="integer")
  36.      * @Gedmo\SortablePosition
  37.      */
  38.     private $position;
  39.     /**
  40.      * @return mixed
  41.      */
  42.     public function __toString()
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getName(): ?string
  51.     {
  52.         return $this->name;
  53.     }
  54.     public function setName(string $name): self
  55.     {
  56.         $this->name $name;
  57.         return $this;
  58.     }
  59.     public function getPosition(): ?int
  60.     {
  61.         return $this->position;
  62.     }
  63.     public function setPosition(int $position): self
  64.     {
  65.         $this->position $position;
  66.         return $this;
  67.     }
  68. }