<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
use App\Repository\ModePayementRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @Vich\Uploadable
*/
#[ORM\Entity(repositoryClass: ModePayementRepository::class)]
#[ApiFilter(BooleanFilter::class, properties: ['isBack'])]
#[ApiResource(
iri: 'http://schema.org/modePayement',
normalizationContext:['groups' => ['mode_payement:read']],
denormalizationContext: ['groups' => ['mode_payement:write']],
collectionOperations: [
'get',
'post' => [
'input_formats' => [
'multipart' => ['multipart/form-data'],
],
],
],
)]
class ModePayement
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
#[Groups(['reservation:read','mode_payement:read','payement:read','TypeModePayement:read'])]
private $id;
#[ORM\Column(type: 'string', length: 50)]
#[Assert\NotBlank]
#[Assert\NotNull]
#[Groups(['mode_payement:write','mode_payement:read','reservation:read','payement:read','TypeModePayement:read'])]
private $label;
#[ORM\Column(type: 'string', length: 255)]
#[Groups(['mode_payement:read','TypeModePayement:read'])]
private $image;
/**
* @Vich\UploadableField(mapping="mode_payement", fileNameProperty="image")
*/
#[Groups(['mode_payement:write'])]
#[Assert\NotBlank]
#[Assert\NotNull]
public ?File $file = null;
#[ORM\Column(type: 'boolean')]
#[Assert\NotBlank]
#[Assert\NotNull]
#[Groups(['mode_payement:write','mode_payement:read'])]
private $isActive;
#[Groups(['mode_payement:read'])]
public $url;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isBack = false;
#[ORM\ManyToOne(targetEntity: TypeModePayement::class, inversedBy: 'modePayements')]
#[ORM\JoinColumn(nullable: false)]
private $typeModePayement;
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function isIsBack(): ?bool
{
return $this->isBack;
}
public function setIsBack(?bool $isBack): self
{
$this->isBack = $isBack;
return $this;
}
public function getTypeModePayement(): ?TypeModePayement
{
return $this->typeModePayement;
}
public function setTypeModePayement(?TypeModePayement $typeModePayement): self
{
$this->typeModePayement = $typeModePayement;
return $this;
}
}