PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Application / Commands / User / Customer / UpdateCustomerStatusCommandHandler.php
ameliabooking / src / Application / Commands / User / Customer Last commit date
AddCustomerCommand.php 7 years ago AddCustomerCommandHandler.php 1 year ago GetCustomerCommand.php 7 years ago GetCustomerCommandHandler.php 1 year ago GetCustomersCommand.php 7 years ago GetCustomersCommandHandler.php 1 year ago UpdateCustomerCommand.php 7 years ago UpdateCustomerCommandHandler.php 1 year ago UpdateCustomerStatusCommand.php 1 year ago UpdateCustomerStatusCommandHandler.php 1 year ago
UpdateCustomerStatusCommandHandler.php
53 lines
1 <?php
2
3 namespace AmeliaBooking\Application\Commands\User\Customer;
4
5 use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException;
6 use AmeliaBooking\Application\Commands\CommandResult;
7 use AmeliaBooking\Application\Commands\CommandHandler;
8 use AmeliaBooking\Infrastructure\Common\Exceptions\QueryExecutionException;
9 use AmeliaBooking\Infrastructure\Repository\User\ProviderRepository;
10
11 /**
12 * Class UpdateCustomerStatusCommandHandler
13 *
14 * @package AmeliaBooking\Application\Common
15 */
16 class UpdateCustomerStatusCommandHandler extends CommandHandler
17 {
18 /**
19 * @var array
20 */
21 public $mandatoryFields = [
22 'status',
23 ];
24
25 /**
26 * @param UpdateCustomerStatusCommand $command
27 *
28 * @return CommandResult
29 * @throws \InvalidArgumentException
30 * @throws QueryExecutionException
31 * @throws InvalidArgumentException
32 */
33 public function handle(UpdateCustomerStatusCommand $command)
34 {
35 $result = new CommandResult();
36
37 $this->checkMandatoryFields($command);
38
39 /** @var ProviderRepository $providerRepository */
40 $providerRepository = $this->container->get('domain.users.providers.repository');
41
42 $status = $command->getField('status');
43
44 $providerRepository->updateFieldById($command->getArg('id'), $status, 'status');
45
46 $result->setResult(CommandResult::RESULT_SUCCESS);
47 $result->setMessage('Successfully updated user');
48 $result->setData(true);
49
50 return $result;
51 }
52 }
53