src/Entity/Plan.php line 10
<?phpnamespace App\Entity;use App\Repository\PlanRepository;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: PlanRepository::class)]class Plan{/*** Types de plan disponibles*/public const TYPE_PLAN = 'plan';public const TYPE_EXTRA = 'extra';/*** Liste des types disponibles pour la validation et l'affichage dans les formulaires*/public const TYPES = ['Abonnement standard' => self::TYPE_PLAN,'Option supplémentaire' => self::TYPE_EXTRA];#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: '0')]private ?string $price = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $longDescription = null;#[ORM\Column(nullable: true)]private ?int $socialMediaPlafond = null;#[ORM\Column(length: 20)]private ?string $type = self::TYPE_PLAN;#[ORM\Column(type: 'boolean', options: ['default' => false])]private bool $defaut = false;#[ORM\Column(type: Types::DECIMAL, precision: 5, scale: 2, options: ['default' => '20.00'])]private ?string $remiseAnnuelle = '20.00';public function getId(): ?int{return $this->id;}public function getPrice(): ?string{return $this->price;}public function setPrice(string $price): static{$this->price = $price;return $this;}public function getSocialMediaPlafond(): ?int{return $this->socialMediaPlafond;}public function setSocialMediaPlafond(int $socialMediaPlafond): static{$this->socialMediaPlafond = $socialMediaPlafond;return $this;}public function getName(): ?string{return $this->name;}public function setName(string $name): static{$this->name = $name;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): static{$this->description = $description;return $this;}public function getLongDescription(): ?string{return $this->longDescription;}public function setLongDescription(?string $longDescription): static{$this->longDescription = $longDescription;return $this;}public function __toString(): string{return $this->name ?? sprintf('Plan %d', $this->socialMediaPlafond);}public function getType(): ?string{return $this->type;}public function setType(string $type): static{if (!in_array($type, [self::TYPE_PLAN, self::TYPE_EXTRA])) {throw new \InvalidArgumentException(sprintf('Type invalide "%s". Les types autorisés sont : %s',$type,implode(', ', [self::TYPE_PLAN, self::TYPE_EXTRA])));}$this->type = $type;return $this;}/*** @return bool True si le plan est de type standard*/public function isPlan(): bool{return $this->type === self::TYPE_PLAN;}/*** @return bool True si le plan est de type extra/option*/public function isExtra(): bool{return $this->type === self::TYPE_EXTRA;}public function isDefaut(): bool{return $this->defaut;}public function setDefaut(bool $defaut): static{$this->defaut = $defaut;return $this;}public function getRemiseAnnuelle(): ?string{return $this->remiseAnnuelle;}public function setRemiseAnnuelle(?string $remiseAnnuelle): static{$this->remiseAnnuelle = $remiseAnnuelle;return $this;}}