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. /**
  12.  * @ApiResource(
  13.  *     attributes={
  14.  *         "denormalization_context": {
  15.  *             "api_allow_update": true
  16.  *         }
  17.  *     },
  18.  *     collectionOperations={
  19.  *         "get": {
  20.  *             "normalization_context": {
  21.  *                 "groups": {"template:list"},
  22.  *             }
  23.  *          },
  24.  *          "post": {
  25.  *              "normalization_context": {
  26.  *                  "groups": {"template:list"},
  27.  *              },
  28.  *              "denormalization_context": {
  29.  *                  "groups": {"template:write"}
  30.  *              }
  31.  *          }
  32.  *     },
  33.  *     itemOperations={
  34.  *         "get": {
  35.  *             "normalization_context": {
  36.  *                 "groups": {"template:read"},
  37.  *             }
  38.  *         },
  39.  *         "put": {
  40.  *             "normalization_context": {
  41.  *                 "groups": {"template:read"},
  42.  *             },
  43.  *             "denormalization_context": {
  44.  *                 "groups": {"template:update"}
  45.  *             }
  46.  *         },
  47.  *         "delete": {}
  48.  *     },
  49.  *     paginationClientEnabled=true,
  50.  *     paginationClientItemsPerPage=true
  51.  * )
  52.  */
  53. class Template implements IriNormalizableInterface
  54. {
  55.     use BlamableTrait;
  56.     use TimestampableTrait;
  57.     use ImportableObjectTrait;
  58.     use NormalizeAsIRITrait;
  59.     /**
  60.      * @ApiProperty(identifier=true)
  61.      *
  62.      * @var string|null
  63.      *
  64.      * @Groups({
  65.      *     "list", "template:list", "template:read"
  66.      * })
  67.      */
  68.     private $id;
  69.     /**
  70.      * @var string|null
  71.      *
  72.      * @Groups({
  73.      *     "template:list", "template:read", "template:write"
  74.      * })
  75.      */
  76.     private $customerId;
  77.     /**
  78.      * @var string|null
  79.      *
  80.      * @Groups({
  81.      *     "list", "template:list", "template:read", "template:write", "template:update"
  82.      * })
  83.      */
  84.     private $name;
  85.     /**
  86.      * @var string|null
  87.      *
  88.      * @Groups({
  89.      *     "list", "template:list", "template:read", "template:write", "template:update"
  90.      * })
  91.      */
  92.     private $content;
  93.     /**
  94.      * @return string|null
  95.      */
  96.     public function getId(): ?string
  97.     {
  98.         return $this->id;
  99.     }
  100.     /**
  101.      * @param string|null $id
  102.      *
  103.      * @return Template
  104.      */
  105.     public function setId(?string $id): Template
  106.     {
  107.         $this->id $id;
  108.         return $this;
  109.     }
  110.     /**
  111.      * @return string|null
  112.      */
  113.     public function getCustomerId(): ?string
  114.     {
  115.         return $this->customerId;
  116.     }
  117.     /**
  118.      * @param string|null $customerId
  119.      *
  120.      * @return Template
  121.      */
  122.     public function setCustomerId(?string $customerId): Template
  123.     {
  124.         $this->customerId $customerId;
  125.         return $this;
  126.     }
  127.     /**
  128.      * @return string|null
  129.      */
  130.     public function getName(): ?string
  131.     {
  132.         return $this->name;
  133.     }
  134.     /**
  135.      * @param string|null $name
  136.      *
  137.      * @return Template
  138.      */
  139.     public function setName(?string $name): Template
  140.     {
  141.         $this->name $name;
  142.         return $this;
  143.     }
  144.     /**
  145.      * @return string|null
  146.      */
  147.     public function getContent(): ?string
  148.     {
  149.         return $this->content;
  150.     }
  151.     /**
  152.      * @param string|null $content
  153.      *
  154.      * @return Template
  155.      */
  156.     public function setContent(?string $content): Template
  157.     {
  158.         $this->content $content;
  159.         return $this;
  160.     }
  161. }