|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Commercetools\Core\Request\Stores\Command; |
| 4 | + |
| 5 | +use Commercetools\Core\Model\Common\Context; |
| 6 | +use Commercetools\Core\Model\ProductSelection\ProductSelectionReference; |
| 7 | +use Commercetools\Core\Model\Store\ProductSelectionSetting; |
| 8 | +use Commercetools\Core\Request\AbstractAction; |
| 9 | + |
| 10 | +/** |
| 11 | + * @package Commercetools\Core\Request\Stores\Command |
| 12 | + * |
| 13 | + * @method string getAction() |
| 14 | + * @method StoreChangeProductSelectionAction setAction(string $action = null) |
| 15 | + * @method ProductSelectionReference getProductSelection() |
| 16 | + * @method StoreChangeProductSelectionAction setProductSelection(ProductSelectionReference $productSelection = null) |
| 17 | + * @method bool getActive() |
| 18 | + * @method StoreChangeProductSelectionAction setActive(bool $active = null) |
| 19 | + */ |
| 20 | +class StoreChangeProductSelectionAction extends AbstractAction |
| 21 | +{ |
| 22 | + public function fieldDefinitions() |
| 23 | + { |
| 24 | + return [ |
| 25 | + 'action' => [static::TYPE => 'string'], |
| 26 | + 'productSelection' => [static::TYPE => ProductSelectionReference::class], |
| 27 | + 'active' => [static::TYPE => 'bool', static::OPTIONAL => 'true'], |
| 28 | + ]; |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * @param array $data |
| 33 | + * @param Context|callable $context |
| 34 | + */ |
| 35 | + public function __construct(array $data = [], $context = null) |
| 36 | + { |
| 37 | + parent::__construct($data, $context); |
| 38 | + $this->setAction('changeProductSelection'); |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * @param ProductSelectionSetting $productSelectionSetting |
| 43 | + * @param Context|callable $context |
| 44 | + * @return StoreChangeProductSelectionAction |
| 45 | + */ |
| 46 | + public static function ofProductSelection(ProductSelectionSetting $productSelectionSetting, $context = null) |
| 47 | + { |
| 48 | + return static::of($context)->setProductSelection($productSelectionSetting); |
| 49 | + } |
| 50 | +} |
0 commit comments