This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #470 from commercetools/ProductTypes-changeAttribu…
…teOrderByName-#453 feat(ProductType): support changeAttributeOrderByName action
- Loading branch information
Showing
4 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/Core/Request/ProductTypes/Command/ProductTypeChangeAttributeOrderByNameAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\ProductTypes\Command; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Model\ProductType\AttributeDefinitionCollection; | ||
use Commercetools\Core\Request\AbstractAction; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\ProductTypes\Command | ||
* @link https://docs.commercetools.com/http-api-projects-productTypes#change-the-order-of-attributedefinitions | ||
* @method string getAction() | ||
* @method ProductTypeChangeAttributeOrderByNameAction setAction(string $action = null) | ||
* @method AttributeDefinitionCollection getAttributes() | ||
* @method ProductTypeChangeAttributeOrderByNameAction setAttributes(AttributeDefinitionCollection $attributes = null) | ||
* @method array getAttributeNames() | ||
* @method ProductTypeChangeAttributeOrderByNameAction setAttributeNames(array $attributeNames = null) | ||
*/ | ||
class ProductTypeChangeAttributeOrderByNameAction extends AbstractAction | ||
{ | ||
public function fieldDefinitions() | ||
{ | ||
return [ | ||
'action' => [static::TYPE => 'string'], | ||
'attributeNames' => [static::TYPE => 'array'], | ||
]; | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @param Context|callable $context | ||
*/ | ||
public function __construct(array $data = [], $context = null) | ||
{ | ||
parent::__construct($data, $context); | ||
$this->setAction('changeAttributeOrderByName'); | ||
} | ||
|
||
/** | ||
* @param array $attributeNames | ||
* @param Context|callable $context | ||
* @return ProductTypeChangeAttributeOrderByNameAction | ||
*/ | ||
public static function ofAttributeNames(array $attributeNames, $context = null) | ||
{ | ||
return static::of($context)->setAttributeNames($attributeNames); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters