2026-07-02 17:15:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Domain\Models\Entities;
|
|
|
|
|
|
2026-07-08 16:32:12 +02:00
|
|
|
use Domain\Models\ValueObjects\Entities\ProductId;
|
2026-07-02 17:15:07 +02:00
|
|
|
use Domain\Models\ValueObjects\Products\NutritionalValues;
|
2026-07-07 13:02:26 +02:00
|
|
|
use Domain\Models\ValueObjects\Products\ProductCategory;
|
2026-07-02 17:15:07 +02:00
|
|
|
use Domain\Models\ValueObjects\Products\Technology;
|
2026-07-08 16:32:12 +02:00
|
|
|
use Shared\DDD\Entity;
|
2026-07-02 17:15:07 +02:00
|
|
|
|
2026-07-08 16:32:12 +02:00
|
|
|
/**
|
|
|
|
|
* @implements Entity<ProductId>
|
|
|
|
|
*/
|
|
|
|
|
readonly class Product implements Entity
|
2026-07-02 17:15:07 +02:00
|
|
|
{
|
|
|
|
|
public function __construct(
|
2026-07-08 16:32:12 +02:00
|
|
|
public ProductId $id,
|
2026-07-02 17:15:07 +02:00
|
|
|
public string $name,
|
2026-07-08 14:55:18 +02:00
|
|
|
public string $slug,
|
2026-07-07 13:02:26 +02:00
|
|
|
public ProductCategory $category,
|
2026-07-02 17:15:07 +02:00
|
|
|
public Technology $technology,
|
|
|
|
|
public bool $isEgalim,
|
|
|
|
|
/** @var \Domain\Models\ValueObjects\Products\BreedingMethod[] */
|
|
|
|
|
public array $breedingMethods,
|
|
|
|
|
/** @var \Domain\Models\ValueObjects\Products\Business[] */
|
|
|
|
|
public array $businesses,
|
|
|
|
|
public string $detailsAndAdvantages,
|
|
|
|
|
/** @var \Domain\Models\ValueObjects\Products\ProductFormat[] */
|
|
|
|
|
public array $formats,
|
|
|
|
|
public string $handlingAdvices,
|
2026-07-08 14:55:18 +02:00
|
|
|
public ?string $ingredients,
|
2026-07-02 17:15:07 +02:00
|
|
|
public string $conservationBeforeOpening,
|
2026-10-19 11:38:58 +02:00
|
|
|
public string $description,
|
2026-10-19 14:55:17 +02:00
|
|
|
public ?string $seoTitle = null,
|
|
|
|
|
public ?string $seoDescription = null,
|
2026-07-02 17:15:07 +02:00
|
|
|
public ?string $conservationAfterOpening = null,
|
|
|
|
|
public ?NutritionalValues $nutritionalValues = null,
|
2026-07-08 14:55:18 +02:00
|
|
|
public ?string $picture = null,
|
|
|
|
|
public ?string $pictureAlt = null,
|
|
|
|
|
public ?string $pictureTitle = null,
|
2026-07-02 17:15:07 +02:00
|
|
|
public ?string $pdfFilePath = null,
|
2026-07-08 16:32:12 +02:00
|
|
|
/** @var \Ramsey\Uuid\UuidInterface[] */
|
2026-07-02 17:15:07 +02:00
|
|
|
public array $associatedRecipes = [],
|
|
|
|
|
) {
|
|
|
|
|
}
|
2026-07-08 16:32:12 +02:00
|
|
|
|
|
|
|
|
public function id(): ProductId
|
|
|
|
|
{
|
|
|
|
|
return $this->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __toString(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->slug;
|
|
|
|
|
}
|
2026-07-02 17:15:07 +02:00
|
|
|
}
|