src/Model/Template/Template.php line 56

Open in your IDE?
  1. <?php
  2. namespace App\Model\Template;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Model\IriNormalizableInterface;
  6. use App\Model\NormalizeAsIRITrait;
  7. use App\Model\Traits\BlamableTrait;
  8. use App\Model\Traits\ImportableObjectTrait;
  9. use App\Model\Traits\TimestampableTrait;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13.  * @ApiResource(
  14.  *     attributes={
  15.  *         "denormalization_context": {
  16.  *             "api_allow_update": true
  17.  *         }
  18.  *     },
  19.  *     collectionOperations={
  20.  *         "get": {
  21.  *             "normalization_context": {
  22.  *                 "groups": {"template:list"},
  23.  *             }
  24.  *          },
  25.  *          "post": {
  26.  *              "normalization_context": {
  27.  *                  "groups": {"template:list"},
  28.  *              },
  29.  *              "denormalization_context": {
  30.  *                  "groups": {"template:write"}
  31.  *              }
  32.  *          }
  33.  *     },
  34.  *     itemOperations={
  35.  *         "get": {
  36.  *             "normalization_context": {
  37.  *                 "groups": {"template:read"},
  38.  *             }
  39.  *         },
  40.  *         "put": {
  41.  *             "normalization_context": {
  42.  *                 "groups": {"template:read"},
  43.  *             },
  44.  *             "denormalization_context": {
  45.  *                 "groups": {"template:update"}
  46.  *             }
  47.  *         },
  48.  *         "delete": {}
  49.  *     },
  50.  *     paginationClientEnabled=true,
  51.  *     paginationClientItemsPerPage=true
  52.  * )
  53.  */
  54. class Template implements IriNormalizableInterface
  55. {
  56.     use BlamableTrait;
  57.     use TimestampableTrait;
  58.     use ImportableObjectTrait;
  59.     use NormalizeAsIRITrait;
  60.     /**
  61.      * @ApiProperty(identifier=true)
  62.      *
  63.      * @var string|null
  64.      *
  65.      * @Groups({
  66.      *     "list", "template:list", "template:read"
  67.      * })
  68.      */
  69.     private $id;
  70.     /**
  71.      * @var string|null
  72.      *
  73.      * @Groups({
  74.      *     "template:list", "template:read", "template:write"
  75.      * })
  76.      */
  77.     private $customerId;
  78.     /**
  79.      * @var string|null
  80.      *
  81.      * @Groups({
  82.      *     "list", "template:list", "template:read", "template:write", "template:update"
  83.      * })
  84.      */
  85.     private $name;
  86.     /**
  87.      * @var string|null
  88.      *
  89.      * @Groups({
  90.      *     "list", "template:list", "template:read", "template:write", "template:update"
  91.      * })
  92.      *
  93.      * @Assert\NotBlank(message= "Ce champ ne peut pas ĂȘtre vide")
  94.      */
  95.     private $filename;
  96.     /**
  97.      * @var string|null
  98.      *
  99.      * @Groups({
  100.      *     "list", "template:list", "template:read", "template:write", "template:update"
  101.      * })
  102.      */
  103.     private $content;
  104.     /**
  105.      * @return string|null
  106.      */
  107.     public function getId(): ?string
  108.     {
  109.         return $this->id;
  110.     }
  111.     /**
  112.      * @param string|null $id
  113.      *
  114.      * @return Template
  115.      */
  116.     public function setId(?string $id): Template
  117.     {
  118.         $this->id $id;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return string|null
  123.      */
  124.     public function getCustomerId(): ?string
  125.     {
  126.         return $this->customerId;
  127.     }
  128.     /**
  129.      * @param string|null $customerId
  130.      *
  131.      * @return Template
  132.      */
  133.     public function setCustomerId(?string $customerId): Template
  134.     {
  135.         $this->customerId $customerId;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return string|null
  140.      */
  141.     public function getName(): ?string
  142.     {
  143.         return $this->name;
  144.     }
  145.     /**
  146.      * @param string|null $name
  147.      *
  148.      * @return Template
  149.      */
  150.     public function setName(?string $name): Template
  151.     {
  152.         $this->name $name;
  153.         return $this;
  154.     }
  155.     public function getFilename(): ?string
  156.     {
  157.         return $this->filename;
  158.     }
  159.     public function setFilename(?string $filename): self
  160.     {
  161.         $this->filename $filename;
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return string|null
  166.      */
  167.     public function getContent(): ?string
  168.     {
  169.         return $this->content;
  170.     }
  171.     /**
  172.      * @param string|null $content
  173.      *
  174.      * @return Template
  175.      */
  176.     public function setContent(?string $content): Template
  177.     {
  178.         $this->content $content;
  179.         return $this;
  180.     }
  181. }