<?phpnamespace App\Entity;use Ambta\DoctrineEncryptBundle\Configuration\Encrypted;use App\Repository\CardRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Blameable\Traits\BlameableEntity;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: CardRepository::class)]class Card{ const BRAND_VISA = 1; const BRAND_MASTERCARD = 2; const BRAND_DINERS = 6; const BRAND_PRIVADA = 7; const BRAND_AMEX = 8; const BRAND_JCB = 9; const BRAND_UP = 22; use BlameableEntity; //Hook blameable behaviour. Updates createdBy, updatedBy fields use TimestampableEntity; //Hook timestampable behaviour. Updates createdAt, updatedAt fields #[ORM\Id] #[ORM\GeneratedValue(strategy: "IDENTITY")] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\ManyToOne(inversedBy: 'cards')] #[ORM\JoinColumn(nullable: false)] private ?User $owner = null; #[ORM\Column(length: 255)] #[Encrypted] private ?string $token = null; #[ORM\Column(length: 255, nullable: true)] private ?string $expiryDate = null; #[ORM\Column()] private ?int $autoNum = null; #[ORM\Column(nullable: true)] private ?int $brand = null; #[ORM\OneToMany(mappedBy: 'card', targetEntity: Order::class)] private Collection $orders; public function __construct() { $this->orders = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getOwner(): ?User { return $this->owner; } public function setOwner(?User $owner): self { $this->owner = $owner; return $this; } public function getToken(): ?string { return $this->token; } public function setToken(string $token): self { $this->token = $token; return $this; } public function getExpiryDate(): ?string { return $this->expiryDate; } public function setExpiryDate(?string $expiryDate): self { $this->expiryDate = $expiryDate; return $this; } public function getAutoNum(): ?int { return $this->autoNum; } public function setAutoNum(int $autoNum): self { $this->autoNum = $autoNum; return $this; } public function getBrand(): ?int { return $this->brand; } public function setBrand(int $brand): self { $this->brand = $brand; return $this; } /** * @return Collection<int, Order> */ public function getOrders(): Collection { return $this->orders; } public function addOrder(Order $order): self { if (!$this->orders->contains($order)) { $this->orders->add($order); $order->setCard($this); } return $this; } public function removeOrder(Order $order): self { if ($this->orders->removeElement($order)) { // set the owning side to null (unless already changed) if ($order->getCard() === $this) { $order->setCard(null); } } return $this; }}