src/Entity/WebsiteParams/WebsiteParams.php line 39

Open in your IDE?
  1. <?php
  2. namespace App\Entity\WebsiteParams;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Repository\WebsiteParams\WebsiteParamsRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Timestampable\Traits\TimestampableEntity;
  8. use Ramsey\Uuid\Uuid;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Serializer\Annotation\SerializedName;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use Ramsey\Uuid\Doctrine\UuidGenerator;
  13. /**
  14.  * @ORM\Entity(repositoryClass=WebsiteParamsRepository::class)
  15.  *
  16.  * @ApiResource(
  17.  *     attributes={
  18.  *          "normalization_context"={"groups"={
  19.  *              "WebsiteParams:output",
  20.  *              "WebsiteParams:io",
  21.  *          }},
  22.  *          "denormalization_context"={"groups"={
  23.  *              "WebsiteParams:input",
  24.  *              "WebsiteParams:io",
  25.  *          }}
  26.  *      },
  27.  * )
  28.  *
  29.  * @ORM\InheritanceType("SINGLE_TABLE")
  30.  * @ORM\DiscriminatorColumn(name="discr", type="string")
  31.  * @ORM\DiscriminatorMap({
  32.  *     "game_params" = "GameParams",
  33.  *     "module_params" = "ModuleParams",
  34.  * })
  35.  */
  36. abstract class WebsiteParams
  37. {
  38.     /**
  39.      * Hook timestampable behavior
  40.      * updates createdAt, updatedAt fields
  41.      */
  42.     use TimestampableEntity;
  43.     /**
  44.      * @ORM\Id
  45.      * @ORM\Column(type="uuid", unique=true)
  46.      * @ORM\GeneratedValue(strategy="CUSTOM")
  47.      * @ORM\CustomIdGenerator(class=UuidGenerator::class)
  48.      * @SerializedName("id")
  49.      * @ApiProperty(identifier=true)
  50.      * @Assert\Uuid()
  51.      * @Groups({
  52.      *     "User:output",
  53.      *     "Token:output",
  54.      *     "ParticipationStep:io",
  55.      *     "get_user_operation_carts",
  56.      *     "post_participation_step_ask_refund",
  57.      * })
  58.      */
  59.     private string $id;
  60.     public function __construct()
  61.     {
  62.         $this->id Uuid::uuid4();
  63.     }
  64.     public function getId(): string
  65.     {
  66.         return $this->id;
  67.     }
  68. }