src/Entity/Store/Store.php line 29
<?phpdeclare(strict_types=1);namespace App\Entity\Store;use App\Entity\Deal\Deal;use App\Entity\Discount\DiscountCoupon;use App\Enum\BillingTypesEnum;use App\Enum\SubscriptionTypeEnum;use App\Repository\Store\StoreRepository;use DateTime;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping\Column;use Doctrine\ORM\Mapping\Entity;use Doctrine\ORM\Mapping\GeneratedValue;use Doctrine\ORM\Mapping\Id;use Doctrine\ORM\Mapping\JoinColumn;use Doctrine\ORM\Mapping\ManyToOne;use Doctrine\ORM\Mapping\OneToMany;use Doctrine\ORM\Mapping\Table;use Symfony\Component\Security\Core\User\UserInterface;use function in_array;#[Entity(repositoryClass: StoreRepository::class)]#[Table(name: 'app_store')]class Store implements UserInterface{#[Id]#[Column(type: 'integer')]#[GeneratedValue]private int $id;#[Column(type: 'string', unique: true)]private string $name;#[Column(type: 'string')]private string $state;#[Column(type: 'json')]private array $roles = [];#[Column(type: 'string', nullable: true)]private ?string $email = null;#[Column(name: 'totally_new', type: 'boolean', options: ['default' => true])]private bool $totallyNew = true;#[Column(name: 'keep_quantity_input', type: 'boolean', options: ['default' => false])]private bool $keepQuantityInput = false;#[Column(name: 'active_theme_id', nullable: true)]private ?string $activeThemeId = null;#[Column(type: 'string', nullable: true, enumType: BillingTypesEnum::class)]private ?BillingTypesEnum $billingType = null;#[Column(type: 'string', nullable: true)]private ?string $currency = null;#[Column(name: 'money_format', type: 'string', nullable: true)]private ?string $moneyFormat = null;#[Column(name: 'access_token', type: 'string', nullable: true)]private ?string $accessToken = null;#[Column(type: 'string', nullable: true)]private ?string $plan = null;#[Column(name: 'mailerlite_id', type: 'string', nullable: true)]private ?string $mailerLiteId = null;#[Column(name: 'installed_at', type: 'datetime', nullable: true)]private ?DateTime $installedAt = null;#[Column(name: 'uninstalled_at', type: 'datetime', nullable: true)]private ?DateTime $uninstalledAt = null;#[OneToMany(mappedBy: 'store', targetEntity: Deal::class)]private Collection $deals;#[ManyToOne(targetEntity: DiscountCoupon::class)]#[JoinColumn(name: 'discount_coupon_id', referencedColumnName: 'id')]private ?DiscountCoupon $discountCoupon = null;#[Column(type: 'string', nullable: true)]private ?string $subscriptionId = null;#[Column(type: 'string', enumType: SubscriptionTypeEnum::class, options: ['default' => SubscriptionTypeEnum::Paid])]private SubscriptionTypeEnum $subscriptionType = SubscriptionTypeEnum::Paid;public function __construct(){$this->deals = new ArrayCollection();}public function getId(): int{return $this->id;}public function setName(string $name): Store{$this->name = $name;return $this;}public function getName(): string{return $this->name;}public function getAccessToken(): ?string{return $this->accessToken;}public function setAccessToken(?string $accessToken): Store{$this->accessToken = $accessToken;return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(?string $email): Store{$this->email = $email;return $this;}public function addDeal(Deal $deal): Store{if ($this->deals->contains($deal) === false) {$this->deals->add($deal);$deal->setStore($this);}return $this;}public function setDeals(Collection $deals): Store{$this->deals = $deals;return $this;}public function getDeals(): Collection{return $this->deals;}public function getBillingType(): ?BillingTypesEnum{return $this->billingType;}public function setBillingType(?BillingTypesEnum $billingType): Store{$this->billingType = $billingType;return $this;}public function getDealsByDiscountId(string $discountId): Collection{return $this->deals->filter(fn(Deal $deal) => $deal->getDiscountId() === $discountId);}public function isTotallyNew(): bool{return $this->totallyNew;}public function setTotallyNew(bool $totallyNew): Store{$this->totallyNew = $totallyNew;return $this;}public function getMailerLiteId(): ?string{return $this->mailerLiteId;}public function setMailerLiteId(?string $mailerLiteId): Store{$this->mailerLiteId = $mailerLiteId;return $this;}public function getSubscriptionId(): ?string{return $this->subscriptionId;}public function setSubscriptionId(?string $subscriptionId): Store{$this->subscriptionId = $subscriptionId;return $this;}public function getState(): string{return $this->state;}public function setState(string $state): Store{$this->state = $state;return $this;}public function isKeepQuantityInput(): bool{return $this->keepQuantityInput;}public function setKeepQuantityInput(bool $keepQuantityInput): Store{$this->keepQuantityInput = $keepQuantityInput;return $this;}public function getSubscriptionType(): SubscriptionTypeEnum{return $this->subscriptionType;}public function setSubscriptionType(SubscriptionTypeEnum $subscriptionType): Store{$this->subscriptionType = $subscriptionType;return $this;}public function markInstalled(): Store{$this->installedAt = new DateTime();return $this;}public function getPlan(): ?string{return $this->plan;}public function setPlan(?string $plan): Store{$this->plan = $plan;return $this;}public function getInstalledAt(): ?DateTime{return $this->installedAt;}public function setUninstalledAt(?DateTime $uninstalledAt): Store{$this->uninstalledAt = $uninstalledAt;return $this;}public function markUnInstalled(): Store{$this->uninstalledAt = new DateTime();return $this;}public function getUnInstalledAt(): ?DateTime{return $this->uninstalledAt;}public function getDiscountCoupon(): ?DiscountCoupon{return $this->discountCoupon;}public function setDiscountCoupon(?DiscountCoupon $discountCoupon): Store{$this->discountCoupon = $discountCoupon;return $this;}public function getActiveThemeId(): ?string{return $this->activeThemeId;}public function setActiveThemeId(?string $activeThemeId): Store{$this->activeThemeId = $activeThemeId;return $this;}public function getCurrency(): ?string{return $this->currency;}public function setCurrency(?string $currency): Store{$this->currency = $currency;return $this;}public function getMoneyFormat(): ?string{return $this->moneyFormat;}public function setMoneyFormat(?string $moneyFormat): Store{$this->moneyFormat = $moneyFormat;return $this;}/** @return string[] */public function getRoles(): array{return $this->roles;}public function addApiAccessRole(): Store{return $this->addRole('ROLE_API_USER');}public function addPaidUserRole(): Store{return $this->addRole('ROLE_PAID_USER');}public function removePaidUserRole(): Store{return $this->removeRole('ROLE_PAID_USER');}public function isPaid(): bool{return $this->hasRole('ROLE_PAID_USER');}public function hasRole(string $role): bool{return in_array($role, $this->roles, true);}public function addRole(string $role): Store{if (in_array($role, $this->roles, true) === false) {$this->roles[] = $role;}return $this;}public function removeRole(string $role): Store{$this->roles = array_filter($this->roles, static fn(string $r): bool => $r !== $role);return $this;}public function eraseCredentials(): void{}public function getUserIdentifier(): string{return $this->getName();}}