<?php
namespace App\Entity\Vs;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
#[ORM\Table(name: 'vsabo')]
class VsAbo implements \Stringable
{
public const int ABO_STD_OHNE_INSERAT = 2; // ID aus DB
public const int ABO_STD_MIT_INSERAT = 3; // ID aus DB
public const int ABO_PREM_OHNE_INSERAT = 4; // ID aus DB
public const int ABO_PREM_MIT_INSERAT = 5; // ID aus DB
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
#[ORM\OneToMany(mappedBy: 'abo', targetEntity: Vs::class)]
private Collection $vss;
#[ORM\Column(name: 'aboname', type: 'string', length: 200, unique: false, nullable: true)]
private ?string $aboname = null;
#[ORM\Column(name: 'aboname_short', type: 'string', length: 8, nullable: true)]
private ?string $abonameShort = null;
#[ORM\Column(name: 'max_length_vs_titel', type: 'integer', nullable: true)]
private ?int $maxLengthVsTitel = null;
#[ORM\Column(name: 'max_length_vs_beschreibung', type: 'integer', nullable: true)]
private ?int $maxLengthVsBeschreibung = null;
public function __construct()
{
$this->vss = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getAboname(): ?string
{
return $this->aboname;
}
public function setAboname(?string $aboname): VsAbo
{
$this->aboname = $aboname;
return $this;
}
public function getAbonameShort(): ?string
{
return $this->abonameShort;
}
public function setAbonameShort(?string $abonameShort): VsAbo
{
$this->abonameShort = $abonameShort;
return $this;
}
public function getMaxLengthVsTitel(): ?int
{
return $this->maxLengthVsTitel;
}
public function setMaxLengthVsTitel(?int $maxLengthVsTitel): VsAbo
{
$this->maxLengthVsTitel = $maxLengthVsTitel;
return $this;
}
public function getMaxLengthVsBeschreibung(): ?int
{
return $this->maxLengthVsBeschreibung;
}
public function setMaxLengthVsBeschreibung(?int $maxLengthVsBeschreibung): VsAbo
{
$this->maxLengthVsBeschreibung = $maxLengthVsBeschreibung;
return $this;
}
#[\Override]
public function __toString(): string
{
return $this->getAboname();
}
public function addVss(Vs $vss): static
{
$this->vss[] = $vss;
return $this;
}
public function removeVss(Vs $vss): void
{
$this->vss->removeElement($vss);
}
public function getVss(): ArrayCollection|Collection
{
return $this->vss;
}
// Helpers
public function isStandardOhneInserat(): bool
{
return $this->id === self::ABO_STD_OHNE_INSERAT;
}
public function isStandardMitInserat(): bool
{
return $this->id === self::ABO_STD_MIT_INSERAT;
}
public function isStandard(): bool
{
return $this->isStandardOhneInserat() || $this->isStandardMitInserat();
}
public function isPremiumOhneInserat(): bool
{
return $this->id === self::ABO_PREM_OHNE_INSERAT;
}
public function isPremiumMitInserat(): bool
{
return $this->id === self::ABO_PREM_MIT_INSERAT;
}
public function isPremium(): bool
{
return $this->isPremiumOhneInserat() || $this->isPremiumMitInserat();
}
}