| @@ 21-43 (lines=23) @@ | ||
| 18 | * @method AttributeDefinitionCollection getAttributes() |
|
| 19 | * @method ProductTypeDraft setAttributes(AttributeDefinitionCollection $attributes = null) |
|
| 20 | */ |
|
| 21 | class ProductTypeDraft extends JsonObject |
|
| 22 | { |
|
| 23 | public function fieldDefinitions() |
|
| 24 | { |
|
| 25 | return [ |
|
| 26 | 'name' => [static::TYPE => 'string'], |
|
| 27 | 'description' => [static::TYPE => 'string'], |
|
| 28 | 'attributes' => [static::TYPE => '\Commercetools\Core\Model\ProductType\AttributeDefinitionCollection'], |
|
| 29 | ]; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @param string $name |
|
| 34 | * @param string $description |
|
| 35 | * @param Context|callable $context |
|
| 36 | * @return ProductTypeDraft |
|
| 37 | */ |
|
| 38 | public static function ofNameAndDescription($name, $description, $context = null) |
|
| 39 | { |
|
| 40 | $draft = static::of($context); |
|
| 41 | return $draft->setName($name)->setDescription($description); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| @@ 20-41 (lines=22) @@ | ||
| 17 | * @method TaxRateCollection getRates() |
|
| 18 | * @method TaxCategoryDraft setRates(TaxRateCollection $rates = null) |
|
| 19 | */ |
|
| 20 | class TaxCategoryDraft extends JsonObject |
|
| 21 | { |
|
| 22 | public function fieldDefinitions() |
|
| 23 | { |
|
| 24 | return [ |
|
| 25 | 'name' => [static::TYPE => 'string'], |
|
| 26 | 'description' => [static::TYPE => 'string'], |
|
| 27 | 'rates' => [static::TYPE => '\Commercetools\Core\Model\TaxCategory\TaxRateCollection'], |
|
| 28 | ]; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param string $name |
|
| 33 | * @param TaxRateCollection $rates |
|
| 34 | * @param Context|callable $context |
|
| 35 | * @return TaxCategoryDraft |
|
| 36 | */ |
|
| 37 | public static function ofNameAndRates($name, TaxRateCollection $rates, $context = null) |
|
| 38 | { |
|
| 39 | return static::of($context)->setName($name)->setRates($rates); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 20-42 (lines=23) @@ | ||
| 17 | * @method LocationCollection getLocations() |
|
| 18 | * @method ZoneDraft setLocations(LocationCollection $locations = null) |
|
| 19 | */ |
|
| 20 | class ZoneDraft extends JsonObject |
|
| 21 | { |
|
| 22 | public function fieldDefinitions() |
|
| 23 | { |
|
| 24 | return [ |
|
| 25 | 'name' => [static::TYPE => 'string'], |
|
| 26 | 'description' => [static::TYPE => 'string'], |
|
| 27 | 'locations' => [static::TYPE => '\Commercetools\Core\Model\Zone\LocationCollection'], |
|
| 28 | ]; |
|
| 29 | } |
|
| 30 | ||
| 31 | ||
| 32 | /** |
|
| 33 | * @param string $name |
|
| 34 | * @param LocationCollection $locations |
|
| 35 | * @param Context|callable $context |
|
| 36 | * @return ZoneDraft |
|
| 37 | */ |
|
| 38 | public static function ofNameAndLocations($name, LocationCollection $locations, $context = null) |
|
| 39 | { |
|
| 40 | return static::of($context)->setName($name)->setLocations($locations); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| @@ 23-43 (lines=21) @@ | ||
| 20 | * @method getValue() |
|
| 21 | * @method CustomObjectDraft setValue($value = null) |
|
| 22 | */ |
|
| 23 | class CustomObjectDraft extends JsonObject |
|
| 24 | { |
|
| 25 | public function fieldDefinitions() |
|
| 26 | { |
|
| 27 | return [ |
|
| 28 | 'container' => [static::TYPE => 'string'], |
|
| 29 | 'key' => [static::TYPE => 'string'], |
|
| 30 | 'value' => [], |
|
| 31 | ]; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param $value |
|
| 36 | * @param Context|callable $context |
|
| 37 | * @return mixed |
|
| 38 | */ |
|
| 39 | public static function ofContainerKeyAndValue($container, $key, $value, $context = null) |
|
| 40 | { |
|
| 41 | return static::of($context)->setContainer($container)->setKey($key)->setValue($value); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||