/
vladislavts
/
gcppmsp
Обзор
Документация
Войти
/
vladislavts
/
gcppmsp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
prod
src/Entity/Card.php
224 строки
5 KB
vladislav_ts@list.ru
Сздал УРЛ с удалением пользователей
08 сен 2024, 13:26
08 сен 2024, 13:26
c74805c
Код
Авторство
О чём код?
<?php namespace App\Entity; use App\Repository\CardRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity; #[ORM\Entity(repositoryClass: CardRepository::class)] #[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: false)] class Card { // use Timestampable; // use SoftDeleteableEntity; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\ManyToOne(inversedBy: 'cards')] #[ORM\JoinColumn(nullable: false)] private ?User $specialist = null; #[ORM\Column(type: 'date', nullable: true)] private $date; #[ORM\OneToMany(mappedBy: 'card', targetEntity: Visitor::class)] private $visitors; #[ORM\ManyToOne(inversedBy: 'cards')] #[ORM\JoinColumn(nullable: false)] private ?Filial $filial = null; #[ORM\ManyToOne(inversedBy: 'cards')] #[ORM\JoinColumn(nullable: false)] private ?Service $service = null; #[ORM\Column] private ?int $start = null; #[ORM\Column] private ?int $endTime = null; // #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] #[ORM\Column(type: Types::DATETIME_MUTABLE)] #[Gedmo\Timestampable(on: 'create')] private ?\DateTimeInterface $createdAt = null; // #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] #[ORM\Column(type: Types::DATETIME_MUTABLE)] #[Gedmo\Timestampable(on: 'update')] private ?\DateTimeInterface $updatedAt = null; /** * @var \DateTime|null * * @ORM\Column(name="deletedAt", type="datetime", nullable=true) */ #[ORM\Column(name: 'deletedAt', type: Types::DATETIME_MUTABLE, nullable: true)] private $deletedAt; public function __construct() { $this->visitors = new ArrayCollection(); } public function getId() : ?int { return $this->id; } public function getSpecialist() : ?User { return $this->specialist; } public function setSpecialist(?User $specialist) : self { $this->specialist = $specialist; return $this; } public function getDate() : ?\DateTimeInterface { return $this->date; } public function setDate(?\DateTimeInterface $date) : self // public function setDate(string $date): self { $this->date = $date; return $this; } /** * @return Collection<int, Visitor> */ public function getVisitors() : Collection { return $this->visitors; } public function addVisitor(Visitor $visitor) : self { if (! $this->visitors->contains($visitor)) { $this->visitors[] = $visitor; $visitor->setCard($this); } return $this; } public function removeVisitor(Visitor $visitor) : self { if ($this->visitors->removeElement($visitor)) { // set the owning side to null (unless already changed) if ($visitor->getCard() === $this) { $visitor->setCard(null); } } return $this; } public function __toString() : string { return strval($this->getId()); } public function getFilial() : ?Filial { return $this->filial; } public function setFilial(?Filial $filial) : self { $this->filial = $filial; return $this; } public function getService() : ?Service { return $this->service; } public function setService(?Service $service) : self { $this->service = $service; return $this; } public function getStart() : ?int { return $this->start; } public function setStart(int $start) : self { $this->start = $start; return $this; } public function getEndTime() : ?int { return $this->endTime; } public function setEndTime(int $endTime) : self { $this->endTime = $endTime; 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 getDeletedAt() : ?\DateTime { return $this->deletedAt; } public function setDeletedAt(?\DateTime $deletedAt) : void { $this->deletedAt = $deletedAt; } }