1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
<?php
/**
* @author @jenschude <jens.schulze@commercetools.de>
*/
namespace Commercetools\Core\Model\CustomObject;
use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Model\Common\JsonObject;
/**
* @package Commercetools\Core\Model\CustomObject
* @link https://docs.commercetools.com/http-api-projects-custom-objects.html#create-a-customobject
* @method string getContainer()
* @method CustomObjectDraft setContainer(string $container = null)
* @method string getKey()
* @method CustomObjectDraft setKey(string $key = null)
* @method mixed getValue()
* @method CustomObjectDraft setValue($value = null)
* @method int getVersion()
* @method CustomObjectDraft setVersion(int $version = null)
*/
class CustomObjectDraft extends JsonObject
{
public function fieldDefinitions()
{
return [
'version' => [static::TYPE => 'int', static::OPTIONAL => true],
'container' => [static::TYPE => 'string'],
'key' => [static::TYPE => 'string'],
'value' => [],
];
}
/**
* @param $value
* @param Context|callable $context
* @return CustomObjectDraft
*/
public static function ofContainerKeyAndValue($container, $key, $value, $context = null)
{
return static::of($context)->setContainer($container)->setKey($key)->setValue($value);
}
}