<?php
namespace Postroyka\AppBundle\Entity;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Submarine\CoreBundle\Entity\SubmarineEntityInterface;
use Submarine\CoreBundle\Uploader\AbstractUploadEntity;
use Submarine\FilesBundle\Entity\Image;
use Submarine\PagesBundle\Entity\Page;
use Symfony\Component\HttpFoundation\File\File;
/**
* @ORM\Entity
* @ORM\Table(name="page_defected")
*/
class PageDefected extends AbstractUploadEntity implements
SubmarineEntityInterface
{
/**
* @var integer|null
*
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private int $id;
/**
* @var string|null
*
* @ORM\Column(type="text", nullable=true)
*/
private ?string $reason;
/**
* @ORM\ManyToMany(targetEntity="Submarine\FilesBundle\Entity\Image")
* @ORM\JoinTable(name="pages_defected_images",
* joinColumns={@ORM\JoinColumn(name="page_defected_id", referencedColumnName="id", onDelete="CASCADE")},
* inverseJoinColumns={@ORM\JoinColumn(name="image_id", referencedColumnName="id", onDelete="CASCADE", unique=true)}
* )
* @var Collection<int, Image>
*/
private Collection $images;
/**
* @var float|null
*
* @ORM\Column(type="float", scale=2, nullable=true)
*/
private ?float $cost;
/**
* @var integer
*
* @ORM\Column(type="integer", nullable=true)
*/
private int $maxCount;
/**
* @var bool
*
* @ORM\Column(type="boolean")
*/
private bool $isActive = false;
/**
* @var DateTime
*
* @ORM\Column(type="datetime")
*/
private \DateTimeInterface $updatedAt;
/**
* @var Page
*
* @ORM\OneToOne(targetEntity="Submarine\PagesBundle\Entity\Page", inversedBy="pageDefected")
* @ORM\JoinColumn(name="page_id", referencedColumnName="id", onDelete="CASCADE")
*/
private Page $parent;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $b24Id;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $b24TimeInfoUpdate;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $b24StatusUpdate;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $b24PriceUpdate;
//support data
/** @var File */
private $file;
/** @var string */
private $image;
//support data
public function __construct(Page $product)
{
$this->updatedAt = new DateTime();
$this->isActive = false;
$this->maxCount = 1;
$this->parent = $product;
$this->images = new ArrayCollection();
$this->b24StatusUpdate = null;
$this->b24PriceUpdate = null;
$this->b24TimeInfoUpdate = null;
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int|null $id
*/
public function setId(?int $id): void
{
$this->id = $id;
}
/**
* @return string|null
*/
public function getReason(): ?string
{
return $this->reason;
}
/**
* @param string|null $reason
*/
public function setReason(?string $reason): void
{
$this->reason = $reason;
}
/**
* @return Collection
*/
public function getImages(): ArrayCollection|Collection
{
return $this->images;
}
/**
* @param Collection $images
*/
public function setImages(ArrayCollection|Collection $images): void
{
$this->images = $images;
}
/**
* @return float|null
*/
public function getCost(): ?float
{
return $this->cost;
}
/**
* @param float|null $cost
*/
public function setCost(?float $cost): void
{
$this->cost = $cost;
}
/**
* @return int
*/
public function getMaxCount(): int
{
return $this->maxCount;
}
/**
* @param int $maxCount
*/
public function setMaxCount(int $maxCount): void
{
$this->maxCount = $maxCount;
}
/**
* @return bool
*/
public function isActive(): bool
{
return $this->isActive;
}
/**
* @param bool $isActive
*/
public function setIsActive(bool $isActive): void
{
$this->isActive = $isActive;
}
/**
* @return DateTime
*/
public function getUpdatedAt(): DateTime
{
return $this->updatedAt;
}
/**
* @param DateTime $updatedAt
*/
public function setUpdatedAt(DateTime $updatedAt): void
{
$this->updatedAt = $updatedAt;
}
/**
* @return Page
*/
public function getParent(): Page
{
return $this->parent;
}
/**
* @param Page $parent
*/
public function setParent(Page $parent): void
{
$this->parent = $parent;
}
/**
* @return int|null
*/
public function getB24Id(): ?int
{
return $this->b24Id;
}
/**
* @param int|null $b24Id
*/
public function setB24Id(?int $b24Id): void
{
$this->b24Id = $b24Id;
}
/**
* @return int|null
*/
public function getB24TimeInfoUpdate(): ?int
{
return $this->b24TimeInfoUpdate;
}
/**
* @param int|null $b24TimeInfoUpdate
*/
public function setB24TimeInfoUpdate(?int $b24TimeInfoUpdate): void
{
$this->b24TimeInfoUpdate = $b24TimeInfoUpdate;
}
/**
* @return int|null
*/
public function getB24StatusUpdate(): ?int
{
return $this->b24StatusUpdate;
}
/**
* @param int|null $b24StatusUpdate
*/
public function setB24StatusUpdate(?int $b24StatusUpdate): void
{
$this->b24StatusUpdate = $b24StatusUpdate;
}
/**
* @return int|null
*/
public function getB24PriceUpdate(): ?int
{
return $this->b24PriceUpdate;
}
/**
* @param int|null $b24PriceUpdate
*/
public function setB24PriceUpdate(?int $b24PriceUpdate): void
{
$this->b24PriceUpdate = $b24PriceUpdate;
}
//support methods
/**
* Установка файла
*
* @param File $file
*/
public function setFile(File $file = null)
{
$this->file = $file;
}
/**
* Получение файла
* @return File
*/
public function getFile()
{
return $this->file;
}
/**
* Имя сущности
* @return string
*/
public static function entityName()
{
return __CLASS__;
}
/**
* Путь к файлу
*
* @param string $filePath
*/
public function setFilePath($filePath)
{
$this->image = $filePath;
}
/**
* Путь к файлу
* @return string
*/
public function getFilePath()
{
return $this->image;
}
public function postUpload(SubmarineEntityInterface $file) : void
{
$this->images->add($file);
}
//support methods
}