<?php
namespace App\Entity\MediaObject;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Entity\Slider;
use App\Repository\MediaObject\MediaMobileSliderRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\SerializedName;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ApiResource(
* attributes={
* "normalization_context"={"groups"={
* "media_object_read",
* "MediaMobileSlider:output",
* "MediaMobileSlider:io",
* "Slider:output",
* }},
* "denormalization_context"={"groups"={
* "media_object_read",
* "MediaMobileSlider:input",
* "MediaMobileSlider:io",
* "Slider:input",
* }}
* },
* iri="http://schema.org/MediaMobileSlider",
* collectionOperations={
* "get"
* },
* itemOperations={
* "get"
* }
* )
*
* @ORM\Entity(repositoryClass=MediaMobileSliderRepository::class)
* @Vich\Uploadable
*/
class MediaMobileSlider extends MediaObject
{
/**
* @ORM\ManyToOne(targetEntity=Slider::class, inversedBy="mobileSliders", cascade={"persist"})
* @ORM\JoinColumn(nullable=true, name="object_id")
* @SerializedName("slider")
*/
private $slider;
/**
* @var string|null
* @ApiProperty(iri="http://schema.org/contentUrl")
* @SerializedName("content_url")
* @Groups({
* "MediaObject:output",
* "MediaMobileSlider:output",
* "media_object_read",
* "Slider:output",
* })
*/
private $contentUrl;
/**
* @var File|null
* @Assert\NotNull(
* groups={
* "media_object_read",
* "MediaMobileSlider:io",
* "MediaObject:output",
* })
* @Vich\UploadableField(mapping="slider_image", fileNameProperty="filePath")
* @Groups({
* "Slider:output",
* })
*/
public $file;
/**
* @var string|null
*
* @ORM\Column(nullable=true)
* @SerializedName("file_path")
* @Groups({
* "Slider:output",
* })
*/
public $filePath;
/**
* @return mixed
*/
public function getSlider()
{
return $this->slider;
}
public function setSlider($slider)
{
$this->slider = $slider;
return $this;
}
/**
* @return string|null
*/
public function getContentUrl(): ?string
{
return $this->contentUrl;
}
/**
* @param string|null $contentUrl
* @return MediaMobileSlider
*/
public function setContentUrl(?string $contentUrl): MediaMobileSlider
{
$this->contentUrl = $contentUrl;
return $this;
}
/**
* @return string|null
*/
public function __toString()
{
return "".$this->slider;
}
}