4.0.0
ATTENTION: This release contains breaking changes. Please take extra care when updating to this version. See the upgrade guide for more.
PHP Version
- Support for PHP 5.6 was dropped. The library now requires PHP 7.0 or higher, and all files use strict types, with scalar type declarations present whenever possible. As PHP 7.0 is also about to reach end of life, we strongly suggest you upgrade to at least PHP 7.1. However, this major release line of the SDK (version 4) will support PHP 7.0 regardless of its status.
Added
- The
Client
constructor signature was changed:public function __construct(string $accessToken, string $spaceId, string $environmentId = 'master', \Contentful\Delivery\ClientOptions $options = null)
. All options that were previously handled through the remaining parameters or the options array can now be set using theClientOptions
object. See the upgrade guide for a more detailed explanation. [BREAKING] - The
Client
object now implementsContentful\Delivery\Client\ClientInterface
. We encourage users to type hint against this interface rather than against the concrete implementation. - The SDK now offers support for rich text. Check the tutorial on the Contentful website for more.
Changed
- The SDK now uses version 2 of the
contentful/core
package. We encouraged users to check its changelog and upgrade guide. - The
Query::where()
method used to accept a third parameter, which was used to specify the type of search (for instance with operatorsnear
orlte
). As many users did not know this and appended the operator to the first parameter ofwhere()
, now the third parameter was removed. [BREAKING] - The way system properties are handled was completely changed: previously the SDK used a general
SystemProperties
class with many nullable properties, now every resource type has its own system properties implementation. For instance, the callingContentful\Delivery\Resource\Entry::getSystemProperties()
will now return an instance ofContentful\Delivery\SystemProperties\Entry
, which contains only the necessary methods. [BREAKING] - Method
Entry::has()
when checking against a link by default checks if the link can also be resolved. This behavior can be turned off by setting the third parameter tofalse
. - Logic for resolving links was moved from the
Client
to aLinkResolver
object. The client still provides a convenienceresolveLink()
method which forwards the call. - Method
Client::isPreview()
was renamedClient::isPreviewApi()
. Its opposite,Client::isDeliveryApi()
, was also added. [BREAKING] - Method
Contentful\Delivery\Mapper\BaseMapper::hydrate()
was removed. If using a custom mapper, you can use$this->hydrator->hydrate(object|string $target, array $data)
. [BREAKING] - Interface
CacheItemPoolFactoryInterface
now enforces the return type. [BREAKING] - Class
InstanceRepository
was renamedResourcePool
, and methodClient::getInstanceRepository()
was renamedClient::getResourcePool()
. [BREAKING] - Method
ResourcePool::generateKey()
contained the$api
parameter, which was removed as a resource pool object is supposed to operate within a single API context. [BREAKING] - Third parameter of synchronization manager constructor was changed from
$preview
to$isDeliveryApi
, which is the opposite value. However, users should never build the manager themselves, as they should access it throughClient::getSyncronizationManager()
. [BREAKING]
Fixed
- Using magic method
Entry::getSomething()
with an invalid field previously resulte in an error being triggered. This behavior was fixed and now a regularInvalidArgumentException
is thrown. [BREAKING]