<?php
namespace App\Entity\Gos;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass="App\Repository\Gos\PaymentOptionsRepository")
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable()
*/
class PaymentOptions
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $paymentName;
/**
* @ORM\ManyToOne(targetEntity="PaymentSystem", inversedBy="paymentOptions")
* @ORM\JoinColumn()
*/
private $paymentSystem;
/**
* @Assert\File(
* maxSize="1M",
* mimeTypes={"image/png", "image/jpeg"}
* )
*
* @Vich\UploadableField(mapping="product_images", fileNameProperty="iconFileName")
*
* @var File
*/
private $icon;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $iconFileName;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $information;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $linkToPaymentInstructions;
/**
* @ORM\ManyToMany(targetEntity="Country", inversedBy="paymentOptions")
* @ORM\JoinColumn()
*/
private $country;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isAutoRedirect;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $position;
public function __construct()
{
$this->country = new ArrayCollection();
}
/** @ORM\PrePersist() */
public function onPrePersist()
{
$this->createdAt = new \DateTime();
}
/** @ORM\PreUpdate() */
public function onPreUpdate()
{
$this->updatedAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function setIcon(?File $image): self
{
$this->icon = $image;
if ($image)
{
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
return $this;
}
public function getIcon(): ?File
{
return $this->icon;
}
public function getIconFileName(): ?string
{
return $this->iconFileName;
}
public function setIconFileName(?string $iconFileName): self
{
$this->iconFileName = $iconFileName;
return $this;
}
public function getInformation(): ?string
{
return $this->information;
}
public function setInformation(?string $information): self
{
$this->information = $information;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getLinkToPaymentInstructions(): ?string
{
return $this->linkToPaymentInstructions;
}
public function setLinkToPaymentInstructions(?string $linkToPaymentInstructions): self
{
$this->linkToPaymentInstructions = $linkToPaymentInstructions;
return $this;
}
/**
* @return Collection|Country[]
*/
public function getCountry(): Collection
{
return $this->country;
}
public function addCountry(Country $country): self
{
if (!$this->country->contains($country)) {
$this->country[] = $country;
}
return $this;
}
public function removeCountry(Country $country): self
{
if ($this->country->contains($country)) {
$this->country->removeElement($country);
}
return $this;
}
public function getPaymentSystem(): ?PaymentSystem
{
return $this->paymentSystem;
}
public function setPaymentSystem(?PaymentSystem $paymentSystem): self
{
$this->paymentSystem = $paymentSystem;
return $this;
}
public function getIsAutoRedirect(): ?bool
{
return $this->isAutoRedirect;
}
public function setIsAutoRedirect(?bool $isAutoRedirect): self
{
$this->isAutoRedirect = $isAutoRedirect;
return $this;
}
public function getPaymentName(): ?string
{
return $this->paymentName;
}
public function setPaymentName(string $paymentName): self
{
$this->paymentName = $paymentName;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
}