src/Entity/MediaObject/MediaGameParams.php line 44

Open in your IDE?
  1. <?php
  2. namespace App\Entity\MediaObject;
  3. use ApiPlatform\Core\Annotation\ApiProperty;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Entity\WebsiteParams\GameParams;
  6. use App\Repository\MediaObject\MediaGameParamsRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Serializer\Annotation\SerializedName;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  13. /**
  14.  * @ApiResource(
  15.  *     attributes={
  16.  *          "normalization_context"={"groups"={
  17.  *              "media_object_read",
  18.  *              "MediaGameParams:output",
  19.  *              "MediaGameParams:io",
  20.  *              "GameParams:output",
  21.  *          }},
  22.  *          "denormalization_context"={"groups"={
  23.  *              "media_object_read",
  24.  *              "MediaGameParams:input",
  25.  *              "MediaGameParams:io",
  26.  *              "GameParams:input",
  27.  *          }}
  28.  *      },
  29.  *     iri="http://schema.org/MediaGameParams",
  30.  *     collectionOperations={
  31.  *         "get"
  32.  *     },
  33.  *     itemOperations={
  34.  *         "get"
  35.  *     }
  36.  * )
  37.  *
  38.  * @ORM\Entity(repositoryClass=MediaGameParamsRepository::class)
  39.  * @Vich\Uploadable
  40.  */
  41. class MediaGameParams extends MediaObject
  42. {
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity=GameParams::class, inversedBy="mediaGameParams", cascade={"persist"})
  45.      * @ORM\JoinColumn(nullable=true, name="object_id")
  46.      * @SerializedName("game_params")
  47.      */
  48.     private $gameParams;
  49.     /**
  50.      * @var string|null
  51.      * @ApiProperty(iri="http://schema.org/contentUrl")
  52.      * @SerializedName("content_url")
  53.      * @Groups({
  54.      *     "MediaObject:output",
  55.      *     "MediaGameParams:output",
  56.      *     "media_object_read",
  57.      *     "GameParams:output",
  58.      * })
  59.      */
  60.     private $contentUrl;
  61.     /**
  62.      * @var File|null
  63.      * @Assert\NotNull(
  64.      *     groups={
  65.      *     "media_object_read",
  66.      *     "MediaGameParams:io",
  67.      *     "MediaObject:output",
  68.      * })
  69.      * @Vich\UploadableField(mapping="website_params_image", fileNameProperty="filePath")
  70.      * @Groups({
  71.      *     "GameParams:output",
  72.      * })
  73.      */
  74.     public $file;
  75.     /**
  76.      * @var string|null
  77.      *
  78.      * @ORM\Column(nullable=true)
  79.      * @SerializedName("file_path")
  80.      * @Groups({
  81.      *     "GameParams:output",
  82.      * })
  83.      */
  84.     public $filePath;
  85.     public function getGameParams()
  86.     {
  87.         return $this->gameParams;
  88.     }
  89.     public function setGameParams($gameParams): MediaGameParams
  90.     {
  91.         $this->gameParams $gameParams;
  92.         return $this;
  93.     }
  94.     public function getContentUrl(): ?string
  95.     {
  96.         return $this->contentUrl;
  97.     }
  98.     public function setContentUrl(?string $contentUrl): MediaGameParams
  99.     {
  100.         $this->contentUrl $contentUrl;
  101.         return $this;
  102.     }
  103.     public function __toString()
  104.     {
  105.         return "".$this->gameParams;
  106.     }
  107. }