ldc-ovoteam/domain/Models/Entities/Recipe.php

53 lines
1.4 KiB
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace Domain\Models\Entities;
feat(directory): update ProductDirectory to use ProductId - Changed the find method to accept ProductId instead of int. - Added findBySlug method to retrieve products by slug. - Updated getCategoryProducts method to return CategoryProducts type. feat(eloquent): implement findBySlug in EloquentProductDirectory - Implemented findBySlug method to retrieve products by slug. - Updated find method to handle ProductId. feat(dto): enhance CategoryProducts to serialize product IDs - Updated CategoryProducts to serialize product IDs as strings. feat(controller): modify ProductController to handle search limits - Set limitPerCategory to -1 for search functionality. refactor(model): change Product model ID to UUID - Changed the id field in Product model to UUID. - Updated related methods to handle UUIDs. feat(migration): alter products and recipes tables for UUIDs - Updated migrations to use UUIDs for primary keys in products and recipes tables. - Adjusted foreign key constraints in product_recipe table. feat(route): add route model binding for products - Implemented route model binding for products using ProductId and slug. chore(seed): remove CSV import calls from MandatorySeeder - Removed calls to ImportProductsCsvSeeder and ImportRecipesCsvSeeder. feat(entity): create ProductId and RecipeId value objects - Added ProductId and RecipeId classes to encapsulate UUIDs. feat(frontend): update TypeScript interfaces for products - Updated TypeScript interfaces to reflect changes in product structure.
2026-07-08 16:32:12 +02:00
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;
feat(directory): update ProductDirectory to use ProductId - Changed the find method to accept ProductId instead of int. - Added findBySlug method to retrieve products by slug. - Updated getCategoryProducts method to return CategoryProducts type. feat(eloquent): implement findBySlug in EloquentProductDirectory - Implemented findBySlug method to retrieve products by slug. - Updated find method to handle ProductId. feat(dto): enhance CategoryProducts to serialize product IDs - Updated CategoryProducts to serialize product IDs as strings. feat(controller): modify ProductController to handle search limits - Set limitPerCategory to -1 for search functionality. refactor(model): change Product model ID to UUID - Changed the id field in Product model to UUID. - Updated related methods to handle UUIDs. feat(migration): alter products and recipes tables for UUIDs - Updated migrations to use UUIDs for primary keys in products and recipes tables. - Adjusted foreign key constraints in product_recipe table. feat(route): add route model binding for products - Implemented route model binding for products using ProductId and slug. chore(seed): remove CSV import calls from MandatorySeeder - Removed calls to ImportProductsCsvSeeder and ImportRecipesCsvSeeder. feat(entity): create ProductId and RecipeId value objects - Added ProductId and RecipeId classes to encapsulate UUIDs. feat(frontend): update TypeScript interfaces for products - Updated TypeScript interfaces to reflect changes in product structure.
2026-07-08 16:32:12 +02:00
use Shared\DDD\Entity;
feat(directory): update ProductDirectory to use ProductId - Changed the find method to accept ProductId instead of int. - Added findBySlug method to retrieve products by slug. - Updated getCategoryProducts method to return CategoryProducts type. feat(eloquent): implement findBySlug in EloquentProductDirectory - Implemented findBySlug method to retrieve products by slug. - Updated find method to handle ProductId. feat(dto): enhance CategoryProducts to serialize product IDs - Updated CategoryProducts to serialize product IDs as strings. feat(controller): modify ProductController to handle search limits - Set limitPerCategory to -1 for search functionality. refactor(model): change Product model ID to UUID - Changed the id field in Product model to UUID. - Updated related methods to handle UUIDs. feat(migration): alter products and recipes tables for UUIDs - Updated migrations to use UUIDs for primary keys in products and recipes tables. - Adjusted foreign key constraints in product_recipe table. feat(route): add route model binding for products - Implemented route model binding for products using ProductId and slug. chore(seed): remove CSV import calls from MandatorySeeder - Removed calls to ImportProductsCsvSeeder and ImportRecipesCsvSeeder. feat(entity): create ProductId and RecipeId value objects - Added ProductId and RecipeId classes to encapsulate UUIDs. feat(frontend): update TypeScript interfaces for products - Updated TypeScript interfaces to reflect changes in product structure.
2026-07-08 16:32:12 +02:00
/**
* @implements Entity<RecipeId>
*/
readonly class Recipe implements Entity
{
public function __construct(
feat(directory): update ProductDirectory to use ProductId - Changed the find method to accept ProductId instead of int. - Added findBySlug method to retrieve products by slug. - Updated getCategoryProducts method to return CategoryProducts type. feat(eloquent): implement findBySlug in EloquentProductDirectory - Implemented findBySlug method to retrieve products by slug. - Updated find method to handle ProductId. feat(dto): enhance CategoryProducts to serialize product IDs - Updated CategoryProducts to serialize product IDs as strings. feat(controller): modify ProductController to handle search limits - Set limitPerCategory to -1 for search functionality. refactor(model): change Product model ID to UUID - Changed the id field in Product model to UUID. - Updated related methods to handle UUIDs. feat(migration): alter products and recipes tables for UUIDs - Updated migrations to use UUIDs for primary keys in products and recipes tables. - Adjusted foreign key constraints in product_recipe table. feat(route): add route model binding for products - Implemented route model binding for products using ProductId and slug. chore(seed): remove CSV import calls from MandatorySeeder - Removed calls to ImportProductsCsvSeeder and ImportRecipesCsvSeeder. feat(entity): create ProductId and RecipeId value objects - Added ProductId and RecipeId classes to encapsulate UUIDs. feat(frontend): update TypeScript interfaces for products - Updated TypeScript interfaces to reflect changes in product structure.
2026-07-08 16:32:12 +02:00
public readonly RecipeId $id,
public string $name,
public string $slug,
public ?string $picture,
public ?string $seoTitle,
public ?string $seoDescription,
feat(directory): update ProductDirectory to use ProductId - Changed the find method to accept ProductId instead of int. - Added findBySlug method to retrieve products by slug. - Updated getCategoryProducts method to return CategoryProducts type. feat(eloquent): implement findBySlug in EloquentProductDirectory - Implemented findBySlug method to retrieve products by slug. - Updated find method to handle ProductId. feat(dto): enhance CategoryProducts to serialize product IDs - Updated CategoryProducts to serialize product IDs as strings. feat(controller): modify ProductController to handle search limits - Set limitPerCategory to -1 for search functionality. refactor(model): change Product model ID to UUID - Changed the id field in Product model to UUID. - Updated related methods to handle UUIDs. feat(migration): alter products and recipes tables for UUIDs - Updated migrations to use UUIDs for primary keys in products and recipes tables. - Adjusted foreign key constraints in product_recipe table. feat(route): add route model binding for products - Implemented route model binding for products using ProductId and slug. chore(seed): remove CSV import calls from MandatorySeeder - Removed calls to ImportProductsCsvSeeder and ImportRecipesCsvSeeder. feat(entity): create ProductId and RecipeId value objects - Added ProductId and RecipeId classes to encapsulate UUIDs. feat(frontend): update TypeScript interfaces for products - Updated TypeScript interfaces to reflect changes in product structure.
2026-07-08 16:32:12 +02:00
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 = [],
feat(directory): update ProductDirectory to use ProductId - Changed the find method to accept ProductId instead of int. - Added findBySlug method to retrieve products by slug. - Updated getCategoryProducts method to return CategoryProducts type. feat(eloquent): implement findBySlug in EloquentProductDirectory - Implemented findBySlug method to retrieve products by slug. - Updated find method to handle ProductId. feat(dto): enhance CategoryProducts to serialize product IDs - Updated CategoryProducts to serialize product IDs as strings. feat(controller): modify ProductController to handle search limits - Set limitPerCategory to -1 for search functionality. refactor(model): change Product model ID to UUID - Changed the id field in Product model to UUID. - Updated related methods to handle UUIDs. feat(migration): alter products and recipes tables for UUIDs - Updated migrations to use UUIDs for primary keys in products and recipes tables. - Adjusted foreign key constraints in product_recipe table. feat(route): add route model binding for products - Implemented route model binding for products using ProductId and slug. chore(seed): remove CSV import calls from MandatorySeeder - Removed calls to ImportProductsCsvSeeder and ImportRecipesCsvSeeder. feat(entity): create ProductId and RecipeId value objects - Added ProductId and RecipeId classes to encapsulate UUIDs. feat(frontend): update TypeScript interfaces for products - Updated TypeScript interfaces to reflect changes in product structure.
2026-07-08 16:32:12 +02:00
) {
}
public function id(): RecipeId
{
return $this->id;
}
public function __toString(): string
{
return (string) $this->id;
}
}