Practical Module Development for Prestashop 8 by Louis AUTHIE

Practical Module Development for Prestashop 8 by Louis AUTHIE

Author:Louis AUTHIE
Language: eng
Format: epub
Publisher: Packt
Published: 2023-05-15T00:00:00+00:00


Creating the deletion command

As we saw in Chapter 4, The Back Office, our delete Command represents the deletion task and the required elements to make it. We will create the corresponding CommandHandler to execute the deletion task.

Following DDD practices, we need to create the /modules/whcallback/src/Domain/WHCallbackRequest/ folder, which will contain all the business objects linked to our WHCallbackRequest entity.

The DeleteWHCallbackRequestCommand class will be our deletion command and we will store it in the /modules/whcallback/src/Domain/WHCallbackRequest/Command/DeleteWHCallbackRequestCommand.php file. Let’s define it by following this simple code:

<?php namespace WebHelpers\WHCallback\Domain\WHCallbackRequest\Command; class DeleteWHCallbackRequestCommand { private $idRequest; public function __construct(int $idRequest) { $this->idRequest = $idRequest; } public function getIdRequest() { return $this->idRequest; } }

This Command requires the $idRequest integer representing the id_request of the callback request row to delete in the database. We create the corresponding getter to make it available to CommandHandler.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.