src/Entity/Action.php line 21

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActionRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use ApiPlatform\Action\NotFoundAction;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Metadata\ApiResource;
  9. use Symfony\Component\Serializer\Annotation\MaxDepth;
  10. /**
  11.  * Action entity
  12.  */
  13. #[ApiResource(
  14.     normalizationContext: ['enable_max_depth'=>true],
  15. )]
  16. #[ORM\Entity(repositoryClassActionRepository::class)]
  17. class Action
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     /**
  24.      * @var string $name
  25.      */
  26.     #[ORM\Column(length32)]
  27.     private ?string $name null;
  28.     /**
  29.      * Getter for the entity's id property
  30.      * 
  31.      * @return int The id property
  32.      */
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     /**
  38.      * Getter for the entity's name property
  39.      * 
  40.      * @return string The name property
  41.      */
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     /**
  47.      * Setter for the entity's name property
  48.      * 
  49.      * @param $name The property's new value
  50.      * @return self
  51.      */
  52.     public function setName(string $name): self
  53.     {
  54.         $this->name $name;
  55.         return $this;
  56.     }
  57.     /**
  58.      * Converts the entity to a string. Used to show a string that represents the entity in form fields
  59.      * 
  60.      * @return string The Action's name
  61.      */
  62.     public function __toString()    // Used to show the action in the relation with Permission
  63.     {        
  64.         return $this->name;
  65.     }
  66. }