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.
feat(ProductType): add key to product type
- Loading branch information
Jens Schulze
committed
Feb 17, 2016
1 parent
6893790
commit 4e1d393
Showing
4 changed files
with
56 additions
and
0 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
48 changes: 48 additions & 0 deletions
48
src/Request/ProductTypes/Command/ProductTypeSetKeyAction.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,48 @@ | ||
<?php | ||
/** | ||
* @author @jayS-de <jens.schulze@commercetools.de> | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\ProductTypes\Command; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Request\AbstractAction; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\ProductTypes\Command | ||
* @link https://dev.commercetools.com/http-api-projects-productTypes.html#set-key | ||
* @method string getAction() | ||
* @method ProductTypeSetKeyAction setAction(string $action = null) | ||
* @method string getKey() | ||
* @method ProductTypeSetKeyAction setKey(string $key = null) | ||
*/ | ||
class ProductTypeSetKeyAction extends AbstractAction | ||
{ | ||
public function fieldDefinitions() | ||
{ | ||
return [ | ||
'action' => [static::TYPE => 'string'], | ||
'key' => [static::TYPE => 'string'] | ||
]; | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @param Context|callable $context | ||
*/ | ||
public function __construct(array $data = [], $context = null) | ||
{ | ||
parent::__construct($data, $context); | ||
$this->setAction('setKey'); | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @param Context|callable $context | ||
* @return ProductTypeSetKeyAction | ||
*/ | ||
public static function ofKey($key, $context = null) | ||
{ | ||
return static::of($context)->setKey($key); | ||
} | ||
} |
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