diff --git a/Api/Filters/ContainerBySelectionFilter.php b/Api/Filters/ContainerBySelectionFilter.php new file mode 100644 index 0000000..02b0130 --- /dev/null +++ b/Api/Filters/ContainerBySelectionFilter.php @@ -0,0 +1,51 @@ +filterBySelectionId(explode(',', $value)) + ->select(SelectionContainerAssociatedSelectionTableMap::SELECTION_CONTAINER_ID) + ->find() + ->toArray(); + + $query->filterById($containerIds); + } + + public function getDescription(string $resourceClass): array + { + return [ + 'selection_id' => [ + 'type' => 'array', + 'required' => false, + 'description' => 'Filters the containers to return only those linked to the provided selection_id(s).', + 'schema' => [ + 'type' => 'array', + 'items' => [ + 'type' => 'integer', + ], + ], + ], + ]; + } +} diff --git a/Api/Filters/SelectionByContainerFilter.php b/Api/Filters/SelectionByContainerFilter.php new file mode 100644 index 0000000..dfe0a3f --- /dev/null +++ b/Api/Filters/SelectionByContainerFilter.php @@ -0,0 +1,51 @@ +filterBySelectionContainerId(explode(',',$value)) + ->select(SelectionContainerAssociatedSelectionTableMap::SELECTION_ID) + ->find() + ->toArray(); + + $query->filterById($selectionIds); + } + + public function getDescription(string $resourceClass): array + { + return [ + 'container_id' => [ + 'type' => 'array', + 'required' => false, + 'description' => 'Filters the resources to return only those whose container_id is included in the provided list.', + 'schema' => [ + 'type' => 'array', + 'items' => [ + 'type' => 'integer', + ], + ], + ], + ]; + } +} diff --git a/Api/Resource/Selection.php b/Api/Resource/Selection.php new file mode 100644 index 0000000..af0e9f1 --- /dev/null +++ b/Api/Resource/Selection.php @@ -0,0 +1,235 @@ + [self::GROUP_READ]] +)] +#[ApiFilter( + filterClass: SearchFilter::class, + properties: [ + 'id', + 'code', + 'title', + 'selectionProducts.productId' => [ + 'fieldPath' => 'selection_selectionproducts.product_id', + 'strategy' => 'exact', + ], + ] +)] +#[ApiFilter( + filterClass: NotInFilter::class, + properties: [ + 'id', + 'code', + 'title', + 'selectionProducts.productId' => [ + 'fieldPath' => 'selection_selectionproducts.product_id', + 'strategy' => 'exact', + ], + ] +)] +#[ApiFilter( + filterClass: BooleanFilter::class, + properties: [ + 'visible', + ] +)] +#[ApiFilter( + filterClass: OrderFilter::class, + properties: [ + 'title', + 'position', + 'visible', + 'createdAt', + 'updatedAt', + ] +)] +#[ApiFilter( + filterClass: SelectionByContainerFilter::class, +)] +class Selection extends AbstractTranslatableResource +{ + public const ROUTE_NAME_GET_COLLECTION = 'api_selection_get_collection'; + + public const GROUP_READ = 'selection:read'; + + #[Groups([self::GROUP_READ,SelectionContainer::GROUP_READ])] + public ?int $id = null; + + #[Groups([self::GROUP_READ,SelectionContainer::GROUP_READ])] + public ?bool $visible = null; + + #[Groups([self::GROUP_READ,SelectionContainer::GROUP_READ])] + public ?string $code = null; + + #[Groups([self::GROUP_READ,SelectionContainer::GROUP_READ])] + public ?int $position = null; + + #[Groups([self::GROUP_READ])] + public ?\DateTimeInterface $createdAt = null; + + #[Groups([self::GROUP_READ])] + public ?\DateTimeInterface $updatedAt = null; + + #[Groups([self::GROUP_READ])] + public I18nCollection $i18ns; + #[Relation(targetResource: SelectionContainerAssociatedSelection::class)] + #[Groups([self::GROUP_READ])] + public array $selectionContainerAssociatedSelections; + + #[Relation(targetResource: SelectionProduct::class,forceJoin: true)] + #[Groups([self::GROUP_READ])] + public array $selectionProducts; + + #[Relation(targetResource: SelectionImage::class)] + #[Groups([self::GROUP_READ])] + public array $selectionImages; + + #[Relation(targetResource: SelectionContent::class,forceJoin: true)] + #[Groups([self::GROUP_READ])] + public array $selectionContents; + + public function getSelectionImages(): array + { + return $this->selectionImages; + } + + public function setSelectionImages(array $selectionImages): Selection + { + $this->selectionImages = $selectionImages; + return $this; + } + + public function getSelectionContents(): array + { + return $this->selectionContents; + } + + public function setSelectionContents(array $selectionContents): Selection + { + $this->selectionContents = $selectionContents; + return $this; + } + + public function getSelectionProducts(): array + { + return $this->selectionProducts; + } + + public function setSelectionProducts(array $selectionProducts): Selection + { + $this->selectionProducts = $selectionProducts; + return $this; + } + public function getSelectionContainerAssociatedSelections(): array + { + return $this->selectionContainerAssociatedSelections; + } + + public function setSelectionContainerAssociatedSelections(array $selectionContainerAssociatedSelections): Selection + { + $this->selectionContainerAssociatedSelections = $selectionContainerAssociatedSelections; + return $this; + } + + public function getId(): ?int + { + return $this->id; + } + + public function setId(?int $id): Selection + { + $this->id = $id; + return $this; + } + + public function getVisible(): ?bool + { + return $this->visible; + } + + public function setVisible(?bool $visible): Selection + { + $this->visible = $visible; + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(?string $code): Selection + { + $this->code = $code; + return $this; + } + + public function getPosition(): ?int + { + return $this->position; + } + + public function setPosition(?int $position): Selection + { + $this->position = $position; + return $this; + } + + public function getCreatedAt(): ?\DateTimeInterface + { + return $this->createdAt; + } + + public function setCreatedAt(?\DateTimeInterface $createdAt): Selection + { + $this->createdAt = $createdAt; + return $this; + } + + public function getUpdatedAt(): ?\DateTimeInterface + { + return $this->updatedAt; + } + + public function setUpdatedAt(?\DateTimeInterface $updatedAt): Selection + { + $this->updatedAt = $updatedAt; + return $this; + } + + #[Ignore] public static function getPropelRelatedTableMap(): ?TableMap + { + return new SelectionTableMap(); + } + + public static function getI18nResourceClass(): string + { + return SelectionI18n::class; + } +} diff --git a/Api/Resource/SelectionContainer.php b/Api/Resource/SelectionContainer.php new file mode 100644 index 0000000..dd94300 --- /dev/null +++ b/Api/Resource/SelectionContainer.php @@ -0,0 +1,196 @@ + [self::GROUP_READ]] +)] +#[ApiFilter( + filterClass: SearchFilter::class, + properties: [ + 'id', + 'code', + 'title', + ] +)] +#[ApiFilter( + filterClass: NotInFilter::class, + properties: [ + 'id', + 'code', + 'title', + ] +)] +#[ApiFilter( + filterClass: BooleanFilter::class, + properties: [ + 'visible', + ] +)] +#[ApiFilter( + filterClass: OrderFilter::class, + properties: [ + 'id', + 'title', + 'position', + 'visible', + 'createdAt', + 'updatedAt', + ] +)] +#[ApiFilter( + filterClass: ContainerBySelectionFilter::class, +)] +class SelectionContainer extends AbstractTranslatableResource +{ + public const ROUTE_NAME_GET_COLLECTION = 'api_selection_container_get_collection'; + public const GROUP_READ = 'selection_container:read'; + + #[Groups([Selection::GROUP_READ,self::GROUP_READ])] + public ?int $id = null; + + #[Groups([Selection::GROUP_READ,self::GROUP_READ])] + public ?bool $visible = null; + + #[Groups([Selection::GROUP_READ,self::GROUP_READ])] + public ?string $code = null; + + #[Groups([Selection::GROUP_READ,self::GROUP_READ])] + public ?int $position = null; + + #[Relation(targetResource: SelectionContainerAssociatedSelection::class)] + #[Groups([self::GROUP_READ])] + public ?array $selectionContainerAssociatedSelections = null; + + #[Relation(targetResource: SelectionContainerImage::class)] + #[Groups([self::GROUP_READ])] + public ?array $selectionContainerImages; + + public ?\DateTimeInterface $createdAt = null; + public ?\DateTimeInterface $updatedAt = null; + + #[Groups([self::GROUP_READ,Selection::GROUP_READ])] + public I18nCollection $i18ns; + + public function getSelectionContainerImages(): ?array + { + return $this->selectionContainerImages; + } + + public function setSelectionContainerImages(?array $selectionContainerImages): SelectionContainer + { + $this->selectionContainerImages = $selectionContainerImages; + return $this; + } + public function getSelectionContainerAssociatedSelections(): ?array + { + return $this->selectionContainerAssociatedSelections; + } + + public function setSelectionContainerAssociatedSelections(?array $selectionContainerAssociatedSelections): SelectionContainer + { + $this->selectionContainerAssociatedSelections = $selectionContainerAssociatedSelections; + return $this; + } + + public function getId(): ?int + { + return $this->id; + } + + public function setId(?int $id): SelectionContainer + { + $this->id = $id; + return $this; + } + + public function getVisible(): ?bool + { + return $this->visible; + } + + public function setVisible(?bool $visible): SelectionContainer + { + $this->visible = $visible; + return $this; + } + + public function getCode(): ?string + { + return $this->code; + } + + public function setCode(?string $code): SelectionContainer + { + $this->code = $code; + return $this; + } + + public function getPosition(): ?int + { + return $this->position; + } + + public function setPosition(?int $position): SelectionContainer + { + $this->position = $position; + return $this; + } + + public function getCreatedAt(): ?\DateTimeInterface + { + return $this->createdAt; + } + + public function setCreatedAt(?\DateTimeInterface $createdAt): SelectionContainer + { + $this->createdAt = $createdAt; + return $this; + } + + public function getUpdatedAt(): ?\DateTimeInterface + { + return $this->updatedAt; + } + + public function setUpdatedAt(?\DateTimeInterface $updatedAt): SelectionContainer + { + $this->updatedAt = $updatedAt; + return $this; + } + + #[Ignore] public static function getPropelRelatedTableMap(): ?TableMap + { + return new SelectionContainerTableMap(); + } + + public static function getI18nResourceClass(): string + { + return SelectionContainerI18n::class; + } +} diff --git a/Api/Resource/SelectionContainerAssociatedSelection.php b/Api/Resource/SelectionContainerAssociatedSelection.php new file mode 100644 index 0000000..8e27f20 --- /dev/null +++ b/Api/Resource/SelectionContainerAssociatedSelection.php @@ -0,0 +1,65 @@ +id; + } + + public function setId(?int $id): SelectionContainerAssociatedSelection + { + $this->id = $id; + return $this; + } + + public function getSelection(): Selection + { + return $this->selection; + } + + public function setSelection(Selection $selection): SelectionContainerAssociatedSelection + { + $this->selection = $selection; + return $this; + } + + public function getSelectionContainer(): SelectionContainer + { + return $this->selectionContainer; + } + + public function setSelectionContainer(SelectionContainer $selectionContainer): SelectionContainerAssociatedSelection + { + $this->selectionContainer = $selectionContainer; + return $this; + } + + #[Ignore] public static function getPropelRelatedTableMap(): ?TableMap + { + return new SelectionContainerAssociatedSelectionTableMap; + } +} diff --git a/Api/Resource/SelectionContainerI18n.php b/Api/Resource/SelectionContainerI18n.php new file mode 100644 index 0000000..e60909d --- /dev/null +++ b/Api/Resource/SelectionContainerI18n.php @@ -0,0 +1,107 @@ +title; + } + + public function setTitle(?string $title): SelectionContainerI18n + { + $this->title = $title; + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): SelectionContainerI18n + { + $this->description = $description; + return $this; + } + + public function getChapo(): ?string + { + return $this->chapo; + } + + public function setChapo(?string $chapo): SelectionContainerI18n + { + $this->chapo = $chapo; + return $this; + } + + public function getPostscriptum(): ?string + { + return $this->postscriptum; + } + + public function setPostscriptum(?string $postscriptum): SelectionContainerI18n + { + $this->postscriptum = $postscriptum; + return $this; + } + + public function getMetaTitle(): ?string + { + return $this->metaTitle; + } + + public function setMetaTitle(?string $metaTitle): SelectionContainerI18n + { + $this->metaTitle = $metaTitle; + return $this; + } + + public function getMetaDescription(): ?string + { + return $this->metaDescription; + } + + public function setMetaDescription(?string $metaDescription): SelectionContainerI18n + { + $this->metaDescription = $metaDescription; + return $this; + } + + public function getMetaKeywords(): ?string + { + return $this->metaKeywords; + } + + public function setMetaKeywords(?string $metaKeywords): SelectionContainerI18n + { + $this->metaKeywords = $metaKeywords; + return $this; + } +} diff --git a/Api/Resource/SelectionContainerImage.php b/Api/Resource/SelectionContainerImage.php new file mode 100644 index 0000000..4f11744 --- /dev/null +++ b/Api/Resource/SelectionContainerImage.php @@ -0,0 +1,85 @@ +id; + } + + public function setId(?int $id): SelectionContainerImage + { + $this->id = $id; + return $this; + } + + public function getFile(): ?string + { + return $this->file; + } + + public function setFile(?string $file): SelectionContainerImage + { + $this->file = $file; + return $this; + } + + public function getPosition(): ?int + { + return $this->position; + } + + public function setPosition(?int $position): SelectionContainerImage + { + $this->position = $position; + return $this; + } + + public function getVisible(): ?bool + { + return $this->visible; + } + + public function setVisible(?bool $visible): SelectionContainerImage + { + $this->visible = $visible; + return $this; + } + + #[Ignore] public static function getPropelRelatedTableMap(): ?TableMap + { + return new SelectionContainerImageTableMap(); + } + + public static function getI18nResourceClass(): string + { + return SelectionContainerImageI18n::class; + } +} diff --git a/Api/Resource/SelectionContainerImageI18n.php b/Api/Resource/SelectionContainerImageI18n.php new file mode 100644 index 0000000..b0aa503 --- /dev/null +++ b/Api/Resource/SelectionContainerImageI18n.php @@ -0,0 +1,65 @@ +title; + } + + public function setTitle(?string $title): SelectionContainerImageI18n + { + $this->title = $title; + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): SelectionContainerImageI18n + { + $this->description = $description; + return $this; + } + + public function getChapo(): ?string + { + return $this->chapo; + } + + public function setChapo(?string $chapo): SelectionContainerImageI18n + { + $this->chapo = $chapo; + return $this; + } + + public function getPostscriptum(): ?string + { + return $this->postscriptum; + } + + public function setPostscriptum(?string $postscriptum): SelectionContainerImageI18n + { + $this->postscriptum = $postscriptum; + return $this; + } +} diff --git a/Api/Resource/SelectionContent.php b/Api/Resource/SelectionContent.php new file mode 100644 index 0000000..b137779 --- /dev/null +++ b/Api/Resource/SelectionContent.php @@ -0,0 +1,61 @@ +contentId; + } + + public function setContentId(?int $contentId): SelectionContent + { + $this->contentId = $contentId; + return $this; + } + + public function getSelectionId(): ?int + { + return $this->selectionId; + } + + public function setSelectionId(?int $selectionId): SelectionContent + { + $this->selectionId = $selectionId; + return $this; + } + + public function getPosition(): ?int + { + return $this->position; + } + + public function setPosition(?int $position): SelectionContent + { + $this->position = $position; + return $this; + } + + #[Ignore] public static function getPropelRelatedTableMap(): ?TableMap + { + return new SelectionContentTableMap(); + } +} diff --git a/Api/Resource/SelectionI18n.php b/Api/Resource/SelectionI18n.php new file mode 100644 index 0000000..2b7cd2c --- /dev/null +++ b/Api/Resource/SelectionI18n.php @@ -0,0 +1,107 @@ +title; + } + + public function setTitle(?string $title): SelectionI18n + { + $this->title = $title; + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): SelectionI18n + { + $this->description = $description; + return $this; + } + + public function getChapo(): ?string + { + return $this->chapo; + } + + public function setChapo(?string $chapo): SelectionI18n + { + $this->chapo = $chapo; + return $this; + } + + public function getPostscriptum(): ?string + { + return $this->postscriptum; + } + + public function setPostscriptum(?string $postscriptum): SelectionI18n + { + $this->postscriptum = $postscriptum; + return $this; + } + + public function getMetaTitle(): ?string + { + return $this->metaTitle; + } + + public function setMetaTitle(?string $metaTitle): SelectionI18n + { + $this->metaTitle = $metaTitle; + return $this; + } + + public function getMetaDescription(): ?string + { + return $this->metaDescription; + } + + public function setMetaDescription(?string $metaDescription): SelectionI18n + { + $this->metaDescription = $metaDescription; + return $this; + } + + public function getMetaKeywords(): ?string + { + return $this->metaKeywords; + } + + public function setMetaKeywords(?string $metaKeywords): SelectionI18n + { + $this->metaKeywords = $metaKeywords; + return $this; + } +} diff --git a/Api/Resource/SelectionImage.php b/Api/Resource/SelectionImage.php new file mode 100644 index 0000000..5ab45fa --- /dev/null +++ b/Api/Resource/SelectionImage.php @@ -0,0 +1,71 @@ +file; + } + + public function setFile(?string $file): SelectionImage + { + $this->file = $file; + return $this; + } + + public function getPosition(): ?int + { + return $this->position; + } + + public function setPosition(?int $position): SelectionImage + { + $this->position = $position; + return $this; + } + + public function getVisible(): ?bool + { + return $this->visible; + } + + public function setVisible(?bool $visible): SelectionImage + { + $this->visible = $visible; + return $this; + } + + #[Ignore] public static function getPropelRelatedTableMap(): ?TableMap + { + return new SelectionImageTableMap(); + } + + public static function getI18nResourceClass(): string + { + return SelectionImageI18n::class; + } +} diff --git a/Api/Resource/SelectionImageI18n.php b/Api/Resource/SelectionImageI18n.php new file mode 100644 index 0000000..a495c5b --- /dev/null +++ b/Api/Resource/SelectionImageI18n.php @@ -0,0 +1,65 @@ +title; + } + + public function setTitle(?string $title): SelectionImageI18n + { + $this->title = $title; + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(?string $description): SelectionImageI18n + { + $this->description = $description; + return $this; + } + + public function getChapo(): ?string + { + return $this->chapo; + } + + public function setChapo(?string $chapo): SelectionImageI18n + { + $this->chapo = $chapo; + return $this; + } + + public function getPostscriptum(): ?string + { + return $this->postscriptum; + } + + public function setPostscriptum(?string $postscriptum): SelectionImageI18n + { + $this->postscriptum = $postscriptum; + return $this; + } +} diff --git a/Api/Resource/SelectionProduct.php b/Api/Resource/SelectionProduct.php new file mode 100644 index 0000000..7b9e638 --- /dev/null +++ b/Api/Resource/SelectionProduct.php @@ -0,0 +1,61 @@ +productId; + } + + public function setProductId(?int $productId): SelectionProduct + { + $this->productId = $productId; + return $this; + } + + public function getSelectionId(): ?int + { + return $this->selectionId; + } + + public function setSelectionId(?int $selectionId): SelectionProduct + { + $this->selectionId = $selectionId; + return $this; + } + + public function getPosition(): ?int + { + return $this->position; + } + + public function setPosition(?int $position): SelectionProduct + { + $this->position = $position; + return $this; + } + + #[Ignore] public static function getPropelRelatedTableMap(): ?TableMap + { + return new SelectionProductTableMap(); + } +} diff --git a/Controller/SelectionRelatedContentController.php b/Controller/SelectionRelatedContentController.php index 7985d56..a19f8b1 100644 --- a/Controller/SelectionRelatedContentController.php +++ b/Controller/SelectionRelatedContentController.php @@ -18,7 +18,7 @@ class SelectionRelatedContentController extends BaseAdminController { - protected $currentRouter = Selection::ROUTER; + protected string $currentRouter = Selection::ROUTER; /** * Return content id & title diff --git a/Controller/SelectionUpdateController.php b/Controller/SelectionUpdateController.php index 1103659..8ad6449 100644 --- a/Controller/SelectionUpdateController.php +++ b/Controller/SelectionUpdateController.php @@ -29,7 +29,7 @@ class SelectionUpdateController extends AbstractSeoCrudController { - protected $currentRouter = Selection::ROUTER; + protected string $currentRouter = Selection::ROUTER; /** * Save content of the selection diff --git a/Event/SelectionEvents.php b/Event/SelectionEvents.php index f454546..bca0c96 100644 --- a/Event/SelectionEvents.php +++ b/Event/SelectionEvents.php @@ -4,38 +4,38 @@ class SelectionEvents { - const BEFORE_CREATE_SELECTION = 'action.selection.before.create'; - const AFTER_CREATE_SELECTION = 'action.selection.after.create'; - const SELECTION_CREATE = 'action.selection.create'; + public const BEFORE_CREATE_SELECTION = 'action.selection.before.create'; + public const AFTER_CREATE_SELECTION = 'action.selection.after.create'; + public const SELECTION_CREATE = 'action.selection.create'; - const BEFORE_UPDATE_SELECTION = 'action.selection.before.update'; - const AFTER_UPDATE_SELECTION = 'action.selection.after.update'; - const SELECTION_UPDATE = 'action.selection.update'; + public const BEFORE_UPDATE_SELECTION = 'action.selection.before.update'; + public const AFTER_UPDATE_SELECTION = 'action.selection.after.update'; + public const SELECTION_UPDATE = 'action.selection.update'; - const BEFORE_DELETE_SELECTION = 'action.selection.before.delete'; - const AFTER_DELETE_SELECTION = 'action.selection.after.delete'; - const SELECTION_DELETE = 'action.selection.delete'; + public const BEFORE_DELETE_SELECTION = 'action.selection.before.delete'; + public const AFTER_DELETE_SELECTION = 'action.selection.after.delete'; + public const SELECTION_DELETE = 'action.selection.delete'; - const SELECTION_UPDATE_SEO = 'action.selection.update.seo'; - const SELECTION_TOGGLE_VISIBILITY = 'action.toggle.selection.visibility'; - const SELECTION_UPDATE_POSITION = 'action.selection.update.position'; - const RELATED_PRODUCT_UPDATE_POSITION = 'action.selection.relatedProduct.update.position'; + public const SELECTION_UPDATE_SEO = 'action.selection.update.seo'; + public const SELECTION_TOGGLE_VISIBILITY = 'action.toggle.selection.visibility'; + public const SELECTION_UPDATE_POSITION = 'action.selection.update.position'; + public const RELATED_PRODUCT_UPDATE_POSITION = 'action.selection.relatedProduct.update.position'; //CONTAINER EVENTS - const SELECTION_CONTAINER_CREATE = 'action.selection.container.create'; - const SELECTION_CONTAINER_DELETE = 'action.selection.container.delete'; - const SELECTION_CONTAINER_UPDATE = 'action.selection.container.update'; - const SELECTION_CONTAINER_UPDATE_POSITION = 'action.selection.container.update.position'; - const SELECTION_CONTAINER_UPDATE_SEO = 'action.selection.container.update.seo'; - const SELECTION_CONTAINER_TOGGLE_VISIBILITY = 'action.selection.container.visibility'; - - const BEFORE_CREATE_SELECTION_CONTAINER = 'action.selection.container.before.create'; - const AFTER_CREATE_SELECTION_CONTAINER = 'action.selection.container.after.create'; - const BEFORE_UPDATE_SELECTION_CONTAINER = 'action.selection.container.before.update'; - const AFTER_UPDATE_SELECTION_CONTAINER = 'action.selection.container.after.update'; - const BEFORE_DELETE_SELECTION_CONTAINER = 'action.selection.container.before.delete'; - const AFTER_DELETE_SELECTION_CONTAINER = 'action.selection.container.after.delete'; + public const SELECTION_CONTAINER_CREATE = 'action.selection.container.create'; + public const SELECTION_CONTAINER_DELETE = 'action.selection.container.delete'; + public const SELECTION_CONTAINER_UPDATE = 'action.selection.container.update'; + public const SELECTION_CONTAINER_UPDATE_POSITION = 'action.selection.container.update.position'; + public const SELECTION_CONTAINER_UPDATE_SEO = 'action.selection.container.update.seo'; + public const SELECTION_CONTAINER_TOGGLE_VISIBILITY = 'action.selection.container.visibility'; + + public const BEFORE_CREATE_SELECTION_CONTAINER = 'action.selection.container.before.create'; + public const AFTER_CREATE_SELECTION_CONTAINER = 'action.selection.container.after.create'; + public const BEFORE_UPDATE_SELECTION_CONTAINER = 'action.selection.container.before.update'; + public const AFTER_UPDATE_SELECTION_CONTAINER = 'action.selection.container.after.update'; + public const BEFORE_DELETE_SELECTION_CONTAINER = 'action.selection.container.before.delete'; + public const AFTER_DELETE_SELECTION_CONTAINER = 'action.selection.container.after.delete'; } diff --git a/Form/CreationCommonFieldsTrait.php b/Form/CreationCommonFieldsTrait.php index 9a30eb7..c94c3cf 100644 --- a/Form/CreationCommonFieldsTrait.php +++ b/Form/CreationCommonFieldsTrait.php @@ -11,7 +11,7 @@ trait CreationCommonFieldsTrait { - protected function addCommonFields() + protected function addCommonFields(): void { $this->formBuilder ->add( diff --git a/Form/SelectionContainerCreateForm.php b/Form/SelectionContainerCreateForm.php index b4070ff..0ff2f0b 100644 --- a/Form/SelectionContainerCreateForm.php +++ b/Form/SelectionContainerCreateForm.php @@ -11,12 +11,12 @@ class SelectionContainerCreateForm extends BaseForm { use CreationCommonFieldsTrait; - protected function buildForm() + protected function buildForm(): void { $this->addCommonFields(); } - public function checkDuplicateCode($value, ExecutionContextInterface $context) + public function checkDuplicateCode($value, ExecutionContextInterface $context): void { if (SelectionContainerQuery::create()->filterByCode($value)->count() > 0) { $context->addViolation( diff --git a/Form/SelectionUpdateForm.php b/Form/SelectionUpdateForm.php index c53653c..c58194e 100644 --- a/Form/SelectionUpdateForm.php +++ b/Form/SelectionUpdateForm.php @@ -31,7 +31,7 @@ class SelectionUpdateForm extends BaseForm /** * Form build for add and update a selection */ - protected function buildForm() + protected function buildForm(): void { $this->initContainers(); $this->formBuilder @@ -166,7 +166,7 @@ public static function getName(): string return "admin_selection_update"; } - private function initContainers() + private function initContainers(): void { $lang = $this->request->getSession() ? $this->request->getSession()->getLang(true) : $this->request->lang = Lang::getDefaultLanguage(); $containers = SelectionContainerQuery::getAll($lang); diff --git a/Hook/BackHook.php b/Hook/BackHook.php index 3bf4f85..a86c821 100644 --- a/Hook/BackHook.php +++ b/Hook/BackHook.php @@ -19,7 +19,7 @@ class BackHook extends BaseHook * * @param HookRenderBlockEvent $event */ - public function onMainTopMenuTools(HookRenderBlockEvent $event) + public function onMainTopMenuTools(HookRenderBlockEvent $event): void { $event->add( [ diff --git a/Readme.md b/Readme.md index 2068442..ec1ac60 100644 --- a/Readme.md +++ b/Readme.md @@ -36,7 +36,7 @@ front of the selection you wish to make visible or invisible. of the selection you wish to edit. - Delete a selection by clicking on the cog button then on the trash button in front of the selection you wish to delete. -You may then display your selection on your website by calling the selection_list loop. +You may then display your selection on your website by calling the selection_loop loop. ## Hook @@ -45,7 +45,7 @@ the left, redirecting to the list of selection. ## Loop -[selection_list] +[selection_loop] This loop returns a list of selections. You can use it to display the selections you've created in your website. @@ -82,7 +82,7 @@ This loop returns a list of selections. You can use it to display the selections ### Exemple ```` - {loop name="selection_list" type="selection_list" visible=true id='1,4'} + {loop name="selection_list" type="selection_loop" visible=true id='1,4'} This selection id : {$SELECTION_ID} This selection title : {$SELECTION_TITLE} This selection code : {$SELECTION_CODE} @@ -154,13 +154,13 @@ This loop returns a list of selections containers. You can use it to display the ### Exemple ```` -{loop name="selection_container" type="selection_container" visible="*" backend_context="1" lang=$lang_id order=$selection_container_order} +{loop name="selection_container" type="selection_container_loop" visible="*" backend_context="1" lang=$lang_id order=$selection_container_order} {$SELECTION_CONTAINER_ID}
{loop type="selection_image" name="selection_image" lang="$edit_language_id" source="selection" source_id=$SELECTION_CONTAINER_ID width="70" height="50" resize_mode="borders" limit="1" visible="true"} {/loop} {{$SELECTION_CONTAINER_ID}}
{$SELECTION_CONTAINER_TITLE}
- {$SELECTION_CONTAINER_POSITION}
+ {$SELECTION_CONTAINER_POSITION}
{/loop} ```` diff --git a/Selection.php b/Selection.php index 09c9325..081b3a3 100644 --- a/Selection.php +++ b/Selection.php @@ -24,11 +24,11 @@ class Selection extends BaseModule { /** @var string */ - const DOMAIN_NAME = 'selection'; - const ROUTER = 'module.Selection'; + public const DOMAIN_NAME = 'selection'; + public const ROUTER = 'module.Selection'; - const RESOURCES_SELECTION = 'admin.selection'; - const CONFIG_ALLOW_PROFILE_ID = 'admin_profile_id'; + public const RESOURCES_SELECTION = 'admin.selection'; + public const CONFIG_ALLOW_PROFILE_ID = 'admin_profile_id'; /** * @param ConnectionInterface|null $con @@ -94,8 +94,8 @@ protected function addRessource($code) public static function configureServices(ServicesConfigurator $servicesConfigurator): void { $servicesConfigurator->load(self::getModuleCode().'\\', __DIR__) - ->exclude([THELIA_MODULE_DIR.ucfirst(self::getModuleCode()).'/I18n/*']) - ->autowire(true) - ->autoconfigure(true); + ->exclude([__DIR__.'/I18n/*']) + ->autowire() + ->autoconfigure(); } } diff --git a/templates/backOffice/default/container-edit.html b/templates/backOffice/default/container-edit.html index c650386..f3f44f7 100644 --- a/templates/backOffice/default/container-edit.html +++ b/templates/backOffice/default/container-edit.html @@ -16,7 +16,7 @@ {block name="main-content"} {$close_url={url path='/admin/selection'}} - {loop name="selection_container" type="selection_container" limit="1" visible="*" id=$selection_container_id} + {loop name="selection_container" type="selection_container_loop" limit="1" visible="*" id=$selection_container_id}