Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements in the Domain namespace #11961

Merged
merged 17 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use Category;
use ImageManager;
use ImageType;
use PrestaShop\PrestaShop\Core\Domain\Category\EditableCategory;
use PrestaShop\PrestaShop\Core\Domain\Category\QueryResult\EditableCategory;
use PrestaShop\PrestaShop\Core\Domain\Category\Exception\CategoryNotFoundException;
use PrestaShop\PrestaShop\Core\Domain\Category\Query\GetCategoryForEditing;
use PrestaShop\PrestaShop\Core\Domain\Category\QueryHandler\GetCategoryForEditingHandlerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@
use Language;
use Link;
use Order;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\AddressInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\BoughtProductInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\CartInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\CustomerInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\DiscountInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\GeneralInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\GroupInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\LastConnectionInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\MessageInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\OrderInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\OrdersInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\PersonalInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\ProductsInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\ReferrerInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\SentEmailInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\Subscriptions;
use PrestaShop\PrestaShop\Core\Domain\Customer\Dto\ViewedProductInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\AddressInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\BoughtProductInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\CartInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\DiscountInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\GeneralInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\GroupInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\LastConnectionInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\MessageInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\OrderInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\OrdersInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\PersonalInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\ProductsInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\ReferrerInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\SentEmailInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\Subscriptions;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\Viewable\ViewedProductInformation;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryResult\ViewableCustomer;
use PrestaShop\PrestaShop\Core\Domain\Customer\Exception\CustomerNotFoundException;
use PrestaShop\PrestaShop\Core\Domain\Customer\Query\GetCustomerForViewing;
use PrestaShop\PrestaShop\Core\Domain\Customer\QueryHandler\GetCustomerForViewingHandlerInterface;
Expand Down Expand Up @@ -117,7 +117,7 @@ public function handle(GetCustomerForViewing $query)

Context::getContext()->customer = $customer;

return new CustomerInformation(
return new ViewableCustomer(
$customerId,
$this->getGeneralInformation($customer),
$this->getPersonalInformation($customer),
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/Group/QueryHandler/GetDefaultGroupsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

use Group;
use PrestaShop\PrestaShop\Core\ConfigurationInterface;
use PrestaShop\PrestaShop\Core\Domain\Group\DataTransferObject\DefaultGroup;
use PrestaShop\PrestaShop\Core\Domain\Group\DefaultGroups;
use PrestaShop\PrestaShop\Core\Domain\Group\QueryResult\DefaultGroup;
use PrestaShop\PrestaShop\Core\Domain\Group\QueryResult\DefaultGroups;
use PrestaShop\PrestaShop\Core\Domain\Group\Query\GetDefaultGroups;
use PrestaShop\PrestaShop\Core\Domain\Group\QueryHandler\GetDefaultGroupsHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Group\ValueObject\GroupId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Meta\QueryHandler;

use Meta;
use PrestaShop\PrestaShop\Core\Domain\Meta\DataTransferObject\LayoutCustomizationPage;
use PrestaShop\PrestaShop\Core\Domain\Meta\QueryResult\LayoutCustomizationPage;
use PrestaShop\PrestaShop\Core\Domain\Meta\Query\GetPagesForLayoutCustomization;
use PrestaShop\PrestaShop\Core\Domain\Meta\QueryHandler\GetPagesForLayoutCustomizationHandlerInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ class BulkDeleteCategoriesCommand

/**
* @param int[] $categoryIds
* @param CategoryDeleteMode $deleteMode
* @param string $deleteMode
*
* @throws CategoryConstraintException
* @throws CategoryException
*/
public function __construct(array $categoryIds, CategoryDeleteMode $deleteMode)
public function __construct(array $categoryIds, $deleteMode)
{
$this
->setCategoryIds($categoryIds)
->setDeleteMode($deleteMode);
->setDeleteMode($deleteMode)
;
}

/**
Expand All @@ -77,13 +78,13 @@ public function getDeleteMode()
}

/**
* @param CategoryDeleteMode $mode
* @param string $mode
*
* @return self
*/
private function setDeleteMode(CategoryDeleteMode $mode)
private function setDeleteMode($mode)
{
$this->deleteMode = $mode;
$this->deleteMode = new CategoryDeleteMode($mode);

return $this;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Core/Domain/Category/Command/DeleteCategoryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class DeleteCategoryCommand
private $deleteMode;

/**
* @param CategoryId $categoryId
* @param CategoryDeleteMode $mode
* @param int $categoryId
* @param string $mode
*/
public function __construct(CategoryId $categoryId, CategoryDeleteMode $mode)
public function __construct($categoryId, $mode)
{
$this->categoryId = $categoryId;
$this->deleteMode = $mode;
$this->categoryId = new CategoryId($categoryId);
$this->deleteMode = new CategoryDeleteMode($mode);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class DeleteCategoryCoverImageCommand
private $categoryId;

/**
* @param CategoryId $categoryId
* @param int $categoryId
*/
public function __construct(CategoryId $categoryId)
public function __construct($categoryId)
{
$this->categoryId = $categoryId;
$this->categoryId = new CategoryId($categoryId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class DeleteCategoryMenuThumbnailImageCommand
private $menuThumbnailId;

/**
* @param CategoryId $categoryId
* @param MenuThumbnailId $menuThumbnailId
* @param int $categoryId
* @param int $menuThumbnailId
*/
public function __construct(CategoryId $categoryId, MenuThumbnailId $menuThumbnailId)
public function __construct($categoryId, $menuThumbnailId)
{
$this->categoryId = $categoryId;
$this->menuThumbnailId = $menuThumbnailId;
$this->categoryId = new CategoryId($categoryId);
$this->menuThumbnailId = new MenuThumbnailId($menuThumbnailId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ class DisableCategoriesCommand extends UpdateCategoriesStatusCommand
*/
public function __construct(array $categoryIds)
{
parent::__construct($categoryIds, new CategoryStatus(CategoryStatus::DISABLED));
parent::__construct($categoryIds, CategoryStatus::DISABLED);
}
}
6 changes: 3 additions & 3 deletions src/Core/Domain/Category/Command/EditCategoryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class EditCategoryCommand extends AbstractCategoryCommand
private $parentCategoryId;

/**
* @param CategoryId $categoryId
* @param int $categoryId
*/
public function __construct(CategoryId $categoryId)
public function __construct($categoryId)
{
$this->categoryId = $categoryId;
$this->categoryId = new CategoryId($categoryId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class EditRootCategoryCommand extends AbstractCategoryCommand
private $categoryId;

/**
* @param CategoryId $categoryId
* @param int $categoryId
*/
public function __construct(CategoryId $categoryId)
public function __construct($categoryId)
{
$this->categoryId = $categoryId;
$this->categoryId = new CategoryId($categoryId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use PrestaShop\PrestaShop\Core\Domain\Category\ValueObject\CategoryStatus;

/**
* Class EnableCategoriesCommand enables provides categories.
* Enables given categories
*/
class EnableCategoriesCommand extends UpdateCategoriesStatusCommand
{
Expand All @@ -43,6 +43,6 @@ class EnableCategoriesCommand extends UpdateCategoriesStatusCommand
*/
public function __construct(array $categoryIds)
{
parent::__construct($categoryIds, new CategoryStatus(CategoryStatus::ENABLED));
parent::__construct($categoryIds, CategoryStatus::ENABLED);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class ToggleCategoryStatusCommand
private $categoryId;

/**
* @param CategoryId $categoryId
* @param int $categoryId
*/
public function __construct(CategoryId $categoryId)
public function __construct($categoryId)
{
$this->categoryId = $categoryId;
$this->categoryId = new CategoryId($categoryId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use PrestaShop\PrestaShop\Core\Domain\Category\ValueObject\CategoryStatus;

/**
* Class ChangeCategoriesStatusCommand updates provided categories status to new given status.
* Updates provided categories to new status
*/
class UpdateCategoriesStatusCommand
{
Expand All @@ -48,16 +48,17 @@ class UpdateCategoriesStatusCommand

/**
* @param int[] $categoryIds
* @param CategoryStatus $newStatus
* @param string $newStatus
*
* @throws CategoryConstraintException
* @throws CategoryException
*/
public function __construct(array $categoryIds, CategoryStatus $newStatus)
public function __construct(array $categoryIds, $newStatus)
{
$this
->setCategoryIds($categoryIds)
->setNewStatus($newStatus);
->setNewStatus($newStatus)
;
}

/**
Expand Down Expand Up @@ -98,13 +99,13 @@ private function setCategoryIds(array $categoryIds)
}

/**
* @param CategoryStatus $newStatus
* @param string $newStatus
*
* @return self
*/
private function setNewStatus(CategoryStatus $newStatus)
private function setNewStatus($newStatus)
{
$this->newStatus = $newStatus;
$this->newStatus = new CategoryStatus($newStatus);

return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Domain/Category/Query/GetCategoryForEditing.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class GetCategoryForEditing
private $categoryId;

/**
* @param CategoryId $categoryId
* @param int $categoryId
*/
public function __construct(CategoryId $categoryId)
public function __construct($categoryId)
{
$this->categoryId = $categoryId;
$this->categoryId = new CategoryId($categoryId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Core\Domain\Category\QueryHandler;

use PrestaShop\PrestaShop\Core\Domain\Category\Query\GetCategoryForEditing;
use PrestaShop\PrestaShop\Core\Domain\Category\QueryResult\EditableCategory;

/**
* Interface GetCategoryForEditingHandlerInterface.
Expand All @@ -35,6 +36,8 @@ interface GetCategoryForEditingHandlerInterface
{
/**
* @param GetCategoryForEditing $query
*
* @return EditableCategory
*/
public function handle(GetCategoryForEditing $query);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/

namespace PrestaShop\PrestaShop\Core\Domain\Category;
namespace PrestaShop\PrestaShop\Core\Domain\Category\QueryResult;

use PrestaShop\PrestaShop\Core\Domain\Category\ValueObject\CategoryId;
use PrestaShop\PrestaShop\Core\Domain\Category\ValueObject\MenuThumbnailId;
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Domain/Customer/Command/EditCustomerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ class EditCustomerCommand
private $riskId;

/**
* @param CustomerId $customerId
* @param int $customerId
*/
public function __construct(CustomerId $customerId)
public function __construct($customerId)
{
$this->customerId = $customerId;
$this->customerId = new CustomerId($customerId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class SavePrivateNoteForCustomerCommand
private $privateNote;

/**
* @param CustomerId $customerId
* @param int $customerId
* @param string $privateNote
*/
public function __construct(CustomerId $customerId, $privateNote)
public function __construct($customerId, $privateNote)
{
$this->assertPrivateNoteIsString($privateNote);

$this->customerId = $customerId;
$this->customerId = new CustomerId($customerId);
$this->privateNote = $privateNote;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class TransformGuestToCustomerCommand
private $customerId;

/**
* @param CustomerId $customerId
* @param int $customerId
*/
public function __construct(CustomerId $customerId)
public function __construct($customerId)
{
$this->customerId = $customerId;
$this->customerId = new CustomerId($customerId);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Domain/Customer/Query/GetCustomerForEditing.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class GetCustomerForEditing
private $customerId;

/**
* @param CustomerId $customerId
* @param int $customerId
*/
public function __construct(CustomerId $customerId)
public function __construct($customerId)
{
$this->customerId = $customerId;
$this->customerId = new CustomerId($customerId);
}

/**
Expand Down
Loading