This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ProductDiscount): add setValidFromAndUntil update action
Showing
3 changed files
with
87 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
48 changes: 48 additions & 0 deletions
48
src/Core/Request/ProductDiscounts/Command/ProductDiscountSetValidFromAndUntilAction.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 | ||
/** | ||
*/ | ||
|
||
namespace Commercetools\Core\Request\ProductDiscounts\Command; | ||
|
||
use Commercetools\Core\Model\Common\Context; | ||
use Commercetools\Core\Request\AbstractAction; | ||
use Commercetools\Core\Model\Common\DateTimeDecorator; | ||
use DateTime; | ||
|
||
/** | ||
* @package Commercetools\Core\Request\ProductDiscounts\Command | ||
* @link https://docs.commercetools.com/http-api-projects-productDiscounts.html#set-valid-from-and-until | ||
* @method string getAction() | ||
* @method ProductDiscountSetValidFromAndUntilAction setAction(string $action = null) | ||
* @method DateTimeDecorator getValidFrom() | ||
* @method ProductDiscountSetValidFromAndUntilAction setValidFrom(DateTime $validFrom = null) | ||
* @method DateTimeDecorator getValidUntil() | ||
* @method ProductDiscountSetValidFromAndUntilAction setValidUntil(DateTime $validUntil = null) | ||
*/ | ||
class ProductDiscountSetValidFromAndUntilAction extends AbstractAction | ||
{ | ||
public function fieldDefinitions() | ||
{ | ||
return [ | ||
'action' => [static::TYPE => 'string'], | ||
'validFrom' => [ | ||
static::TYPE => DateTime::class, | ||
static::DECORATOR => DateTimeDecorator::class | ||
], | ||
'validUntil' => [ | ||
static::TYPE => DateTime::class, | ||
static::DECORATOR => DateTimeDecorator::class | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* @param Context|callable $context | ||
*/ | ||
public function __construct(array $data = [], $context = null) | ||
{ | ||
parent::__construct($data, $context); | ||
$this->setAction('setValidFromAndUntil'); | ||
} | ||
} |
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