src/Flexy/ShopBundle/Entity/Order/RoomAccess.php line 13
<?php
namespace App\Flexy\ShopBundle\Entity\Order;
use App\Flexy\ShopBundle\Repository\Order\OrderItemRepository;
use App\Repository\Flexy\ShopBundle\Entity\Order\RoomAccessRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: RoomAccessRepository::class)]
class RoomAccess
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $time = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $card = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $door = null;
public function getId(): ?int
{
return $this->id;
}
public function getTime(): ?\DateTimeInterface
{
return $this->time;
}
public function setTime(?\DateTimeInterface $time): static
{
$this->time = $time;
return $this;
}
public function getCard(): ?string
{
return $this->card;
}
public function setCard(?string $card): static
{
$this->card = $card;
return $this;
}
public function getDoor(): ?string
{
return $this->door;
}
public function setDoor(?string $door): static
{
$this->door = $door;
return $this;
}
public function getProductName(?OrderItemRepository $repo = null): string
{
if (!$repo) return '';
$id = (int)substr($this->card, 3);
$product = $repo->findOneBy(['parentOrder' => $id]);
return $product ? $product->getDescription() : 'D';
}
}