52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Domain\Models\Entities;
|
|
|
|
use Domain\Models\ValueObjects\Entities\RecipeId;
|
|
use Domain\Models\ValueObjects\Products\ProductCategory;
|
|
use Domain\Models\ValueObjects\Recipes\ConsumptionTime;
|
|
use Domain\Models\ValueObjects\Recipes\Inspiration;
|
|
use Domain\Models\ValueObjects\Recipes\Season;
|
|
use Shared\DDD\Entity;
|
|
|
|
/**
|
|
* @implements Entity<RecipeId>
|
|
*/
|
|
readonly class Recipe implements Entity
|
|
{
|
|
public function __construct(
|
|
public readonly RecipeId $id,
|
|
public string $name,
|
|
public string $slug,
|
|
public ?string $picture,
|
|
public ?string $seoTitle,
|
|
public ?string $seoDescription,
|
|
public ProductCategory $productRange,
|
|
public ConsumptionTime $consomptionTime,
|
|
public Inspiration $inspiration,
|
|
public Season $season,
|
|
public ?string $description,
|
|
public ?string $details,
|
|
public string $preparationTime,
|
|
public int $guestsCount,
|
|
public string $ingredientsList,
|
|
public string $preparationSteps,
|
|
public ?string $tipsAndAdvices = null,
|
|
// --- Relations ---
|
|
/** @var Product[] */
|
|
public array $associatedProducts = [],
|
|
) {
|
|
}
|
|
|
|
public function id(): RecipeId
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return (string) $this->id;
|
|
}
|
|
}
|