src/Entity/Product/Product.php line 34
<?php/** This file is part of the Pellipop project.** (c) Mobizel** For the full copyright and license information, please view the LICENSE* file that was distributed with this source code.*/declare(strict_types=1);namespace App\Entity\Product;use App\Entity\IdentifiableTrait;use App\Repository\Product\ProductRepository;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;use Sylius\Component\Resource\Annotation\SyliusCrudRoutes;use Sylius\Component\Resource\Model\ResourceInterface;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: ProductRepository::class)]#[ORM\Table(name: 'app_product')]#[SyliusCrudRoutes(alias: 'app.product', path: '/admin/products', section: 'backend', templates: 'backend/crud', grid: 'app_backend_product', except: ['show'], vars: ['all' => ['subheader' => 'app.ui.manage_your_products',],'index' => ['icon' => 'cube',],])]class Product implements ResourceInterface{use IdentifiableTrait;use TimestampableEntity;#[ORM\Column(type: 'string', length: 255)]#[Assert\NotBlank]private ?string $name = null;#[ORM\Column(type: 'integer')]#[Assert\NotBlank, Assert\PositiveOrZero]private int $credits = 0;#[ORM\Column(type: 'integer')]#[Assert\NotBlank, Assert\Positive]private int $albumSize = 0;/** Direct payment price in cents (€). When set, user can pay by card without credits. */#[ORM\Column(type: 'integer', nullable: true)]private ?int $directPriceCents = null;/** Shipping displayed for France in cents (€), for direct payment. */#[ORM\Column(type: 'integer', nullable: true)]private ?int $shippingDisplayCents = null;/** International shipping supplement in cents (€), for direct payment. */#[ORM\Column(type: 'integer', nullable: true)]private ?int $internationalShippingSupplementCents = null;#[ORM\Column(type: 'boolean')]private bool $enabled = true;public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getCredits(): int{return $this->credits;}public function setCredits(int $credits): self{$this->credits = $credits;return $this;}public function getAlbumSize(): int{return $this->albumSize;}public function setAlbumSize(int $albumSize): self{$this->albumSize = $albumSize;return $this;}public function getDirectPriceCents(): ?int{return $this->directPriceCents;}public function setDirectPriceCents(?int $directPriceCents): self{$this->directPriceCents = $directPriceCents;return $this;}public function getShippingDisplayCents(): ?int{return $this->shippingDisplayCents;}public function setShippingDisplayCents(?int $shippingDisplayCents): self{$this->shippingDisplayCents = $shippingDisplayCents;return $this;}public function getInternationalShippingSupplementCents(): ?int{return $this->internationalShippingSupplementCents;}public function setInternationalShippingSupplementCents(?int $internationalShippingSupplementCents): self{$this->internationalShippingSupplementCents = $internationalShippingSupplementCents;return $this;}/** Whether this product can be paid directly (in €). */public function supportsDirectPayment(): bool{return $this->directPriceCents !== null && $this->directPriceCents > 0;}public function __toString(): string{return (string) ($this->getName() ?? $this->getId());}public function getEnabled(): bool{return $this->enabled;}public function setEnabled(bool $enabled): self{$this->enabled = $enabled;return $this;}}