v1.0.0-RC1
Bug Fixes
- CustomerCreateRequest: set correct return object class (d1c100c9, closes #109)
- Requests: fix the usage of relative path by requests (e32d0150)
- Order: set correct return type for order discountCodes (5bbf4f14)
Features
- AnnotationGenerator: add magic method getAt and current with correct type hint to collections (324886db)
- Attribute: add feature to set attribute type definitions to attributes (37546b33)
- AttributeCollection: add feature to set attribute type definitions to attribute collection (af3b558a)
- CartDiscount: add update actions (c0e27dd5)
- Channel:
- Client: add named constructor to Client and Config object (1a0c350f, closes #101)
- Comments: add update actions (54804bf1)
- CustomerGroups: add update actions (30789b76)
- DiscountCodes: add update actions (e3357965)
- Exceptions: wrap http client exceptions (a169611b)
- Inventory: add update actions (12ea56d5)
- JsonObject: add magic getter to access object data as property (7a22cfa7)
- ProductDiscounts: add update actions (24bd9afb)
- ProductTypes: add update actions (50616ef8)
- Project: add project fetch request (4e8d232c, closes #35)
- Requests:
- Review: add update actions (4f1d55c8)
- ShippingMethod:
- State: add update actions (3833ad1d)
- TaxCategory: add update actions (428ba25a)
- Zones: add update actions (a74c3517)
Breaking Changes
-
QueryRequests renamed to singular form
To streamline the naming schemes between the SDKs QueryRequests have been renamed to their singular form. E.g.:
Before:
$request = CategoriesQueryRequest::of();After:
$request = CategoryQueryRequest::of();(8de23283)
-
SingleResourceResponse renamed to ResourceResponse
To streamline the naming schemes between the SDKs SingleResourceResponse has been renamed to ResourceResponse
(4199c815)
-
ImportLineItem renamed to LineItemImportDraft
To streamline the naming schemes between the SDKs ImportProductVariant, ImportLineItem and ImportLineItemCollection
have been renamed to ProductVariantImportDraft, LineItemImportDraft and LineItemImportDraftCollection.(018c7493)
-
CartDiscountCodeReference renamed to DiscountCodeInfo
To streamline the naming schemes between the SDKs CartDiscountCodeReference has been renamed to DiscountCodeInfo
(db14db07)
-
DeleteById requests renamed to Delete requests
To streamline the naming schemes between the SDKs delete requests have been renamed. E.g.:
Before:
$request = ProductDeleteByIdRequest::ofIdAndVersion('<id>', <version>);After:
$request = ProductDeleteRequest::ofIdAndVersion('<id>', <version>);(896e95a9)
-
FetchBy requests renamed to ByGetRequest
To streamline the naming schemes between the SDKs FetchBy requests have been renamed to ByGet requests. E.g.:
Before:
$request = ProductFetchByIdRequest::ofId('<id>');After:
$request = ProductByIdGetRequest::ofId('<id>');(d601dcfc)
-
Document has been renamed to Resource
To streamline the naming schemes between the SDKs Document has been renamed to Resource. Type checks have to be adjusted
Before:
if ($object instanceof \Sphere\Core\Model\Common\Document)After:
if ($object instanceof \Sphere\Core\Model\Common\Resource)(5704fa3e)
-
ProductSearchEndpoint has been renamed
Before:
$endpoint = ProductSearchEndpoint::endpoint();After:
$endpoint = ProductProjectionEndpoint::endpoint();closes #103
(e1b6989f)
-
ProductsSearchRequest has been renamed
Before:
$request = ProductsSearchRequest::of();After:
$request = ProductProjectionSearchRequest::of();closes #103
(bd1bf7b1)
-
config object fromArray method is declared static
Before:
$config = new Config(); $config->fromArray($configArray);After:
$config = Config::fromArray($configArray);closes #101
(1a0c350f)
-
ext-intl is now mandatory
(2afea8ad)
-
getters return null if value is not set
To have a more reliable return values the implied instantiation of empty objects has been removed. This means before using a value is must be set explicit. Example for collections
Before:
$obj = ProductTypeDraft::ofNameAndDescription('test', 'test'); $obj->getAttributes()->add(AttributeDefinition::of()->setName('test'));After:
$obj = ProductTypeDraft::ofNameAndDescription('test', 'test'); $obj->setAttributes(AttributeDefinitionCollection::of()->add(AttributeDefinition::of()->setName('test')));Closes #113
(8b138e7b)
-
all http client exceptions are now wrapped inside the SphereException hierarchy
Before:
try { $response = $client->execute($request) } catch(\GuzzleHttp\Exception\RequestException $e) { ... }After:
try { $response = $client->execute($request) } catch(\Sphere\Core\Error\SphereException $e) { ... }(a169611b)
-
rename client method future to executeAsync
To streamline the request executing methods the future method has been renamed. To migrate the code follow the example:
Before:
$response = $client->future($request);After:
$response = $client->executeAsync($request);(51da11fa)
-
changes the static "of" constructor to named constructors
The static constructor "of" for models and requests needs magic methods in the class header to provide proper IDE support. By using the library as a dependency the magic methods were not correctly used by the IDE. Also the reflection used inside the OfTrait is not the best solution. So now all models and requests should have one or more named constructors which can be properly read by most IDE, don't require reflection for instantiation and can create instances without parameters which is helpful for testing purposes.
- constructor of Models and Requests doesn't have required values anymore
- static "of" constructor instantiates class with given context object. Use named constructors for instantiating models or requests with arguments
(d19a83c1)