Add new DTOs for handling product and category data structures. These DTOs facilitate data transfer and serialization for products and categories. refactor(controller): update ProductController to use executor pattern Refactor ProductController to utilize an executor for handling product creation, updating, and deletion, improving code organization and maintainability. refactor(controller): update RecipeController to use executor pattern Refactor RecipeController to utilize an executor for handling recipe creation, improving code organization and maintainability. chore: remove MediaController Remove MediaController as it is no longer needed in the application. feat(request): enhance StoreProductRequest and UpdateProductRequest Enhance StoreProductRequest and UpdateProductRequest to include methods for transforming request data into input objects for actions. chore: add ActionExecutorService for executing actions and queries Introduce ActionExecutorService to handle the execution of actions and queries with logging and transaction management. chore(deps): update composer dependencies Update composer dependencies to include webmozart/assert for improved type assertions.
61 lines
1.9 KiB
PHP
61 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Domain\Models\Entities;
|
|
|
|
use Domain\Models\ValueObjects\Entities\ProductId;
|
|
use Domain\Models\ValueObjects\Products\NutritionalValues;
|
|
use Domain\Models\ValueObjects\Products\ProductCategory;
|
|
use Domain\Models\ValueObjects\Products\Technology;
|
|
use Shared\DDD\Entity;
|
|
|
|
/**
|
|
* @implements Entity<ProductId>
|
|
*/
|
|
readonly class Product implements Entity
|
|
{
|
|
/**
|
|
* @param \Domain\Models\ValueObjects\Products\BreedingMethod[] $breedingMethods
|
|
* @param \Domain\Models\ValueObjects\Products\Business[] $businesses
|
|
* @param \Domain\Models\ValueObjects\Products\ProductFormat[] $formats
|
|
* @param \Ramsey\Uuid\UuidInterface[] $associatedRecipes
|
|
*/
|
|
public function __construct(
|
|
public ProductId $id,
|
|
public string $name,
|
|
public string $slug,
|
|
public ProductCategory $category,
|
|
public Technology $technology,
|
|
public bool $isEgalim,
|
|
public array $breedingMethods,
|
|
public array $businesses,
|
|
public string $detailsAndAdvantages,
|
|
public array $formats,
|
|
public string $handlingAdvices,
|
|
public ?string $ingredients,
|
|
public string $conservationBeforeOpening,
|
|
public string $description,
|
|
public ?string $seoTitle = null,
|
|
public ?string $seoDescription = null,
|
|
public ?string $conservationAfterOpening = null,
|
|
public ?NutritionalValues $nutritionalValues = null,
|
|
public ?string $picture = null,
|
|
public ?string $pictureAlt = null,
|
|
public ?string $pictureTitle = null,
|
|
public ?string $pdfFilePath = null,
|
|
/** @var \Ramsey\Uuid\UuidInterface[] */
|
|
public array $associatedRecipes = [],
|
|
) {
|
|
}
|
|
|
|
public function id(): ProductId
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->slug;
|
|
}
|
|
}
|