class EnvironmentProxy

EnvironmentProxy class.

This class works as a lazy reference to an environment resource. You can use it for most environment-related needs, such as fetching entries, assets and content types, or creating them (attaching them to this space).

To access this class, you can use the convenience method found in a client object.

$environment = $client->getEnvironmentProxy($spaceId, $environmentId);

The methods provided are very similar to the getX() methods you will find in an actual environment resource object. The main difference is that when fetching a environment resource, you will actually call the API, whereas with this proxy, you're just holding a reference to a certain environment. This is the reason why in most situations you should prefer using an EnvironmentProxy rather than an environment resource.

// Only the entries query will be made
$environment = $client->getEnvironmentProxy($spaceId, $environmentId);
$entries = $environment->getEntries();

// Two queries will be made
$environment = $client->getEnvironment($spaceId, $environmentId);
$entries = $environment->getEntries();

Traits

EnvironmentProxyExtension trait.

Properties

Client $client from EnvironmentProxyExtension

Methods

getSpaceId()

{@inheritdoc}

getEnvironmentId()

{@inheritdoc}

getAsset(string $assetId)

Returns an Asset resource.

getAssets(Query $query = null)

Returns a ResourceArray object which contains Asset resources.

getContentType(string $contentTypeId)

Returns a ContentType resource.

getContentTypes(Query $query = null)

Returns a ResourceArray object which contains ContentType resources.

getPublishedContentType(string $contentTypeId)

Returns a published ContentType resource.

getPublishedContentTypes(Query $query = null)

Returns a ResourceArray object which contains published ContentType resources.

getContentTypeSnapshot(string $contentTypeId, string $snapshotId)

Returns a ContentTypeSnapshot resource.

getContentTypeSnapshots(string $contentTypeId, Query $query = null)

Returns a ResourceArray object which contains ContentTypeSnapshot resources.

getEditorInterface(string $contentTypeId)

Returns an EditorInterface resource.

getEntry(string $entryId)

Returns an Entry resource.

getEntries(Query $query = null)

Returns a ResourceArray object which contains Entry resources.

getEntrySnapshot(string $entryId, string $snapshotId)

Returns a EntrySnapshot resource.

getEntrySnapshots(string $entryId, Query $query = null)

Returns a ResourceArray object which contains EntrySnapshot resources.

getExtension(string $extensionId)

Returns an Extension resource.

getExtensions()

Returns a ResourceArray object containing Extension resources.

getLocale(string $localeId)

Returns a Locale resource.

getLocales()

Returns a ResourceArray object containing Locale resources.

__construct(Client $client, string $spaceId, string $environmentId)

No description

getSpaceProxy()

Returns a proxy to a space resource.

create(CreatableInterface $resource, string $resourceId = '', $parameters = [])

Persist a new resource in Contentful.

resolveLink(Link $link, array $parameters = [])

Resolves a Contentful link scoped to the current space and environment.

toResource()

Returns the Environment resource which corresponds to this proxy.

Details

at line 78
protected getSpaceId()

{@inheritdoc}

at line 86
protected getEnvironmentId()

{@inheritdoc}

getAsset(string $assetId)

Returns an Asset resource.

Parameters

string $assetId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset

getAssets(Query $query = null)

Returns a ResourceArray object which contains Asset resources.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/assets-collection

getContentType(string $contentTypeId)

Returns a ContentType resource.

Parameters

string $contentTypeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/content-type

getContentTypes(Query $query = null)

Returns a ResourceArray object which contains ContentType resources.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/content-type-collection

getPublishedContentType(string $contentTypeId)

Returns a published ContentType resource.

Parameters

string $contentTypeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/activated-content-type-collection

getPublishedContentTypes(Query $query = null)

Returns a ResourceArray object which contains published ContentType resources.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types/activated-content-type-collection

getContentTypeSnapshot(string $contentTypeId, string $snapshotId)

Returns a ContentTypeSnapshot resource.

Parameters

string $contentTypeId
string $snapshotId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshot

getContentTypeSnapshots(string $contentTypeId, Query $query = null)

Returns a ResourceArray object which contains ContentTypeSnapshot resources.

Parameters

string $contentTypeId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection

getEditorInterface(string $contentTypeId)

Returns an EditorInterface resource.

Parameters

string $contentTypeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface

getEntry(string $entryId)

Returns an Entry resource.

Parameters

string $entryId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries/entry

getEntries(Query $query = null)

Returns a ResourceArray object which contains Entry resources.

Parameters

Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries/entries-collection

getEntrySnapshot(string $entryId, string $snapshotId)

Returns a EntrySnapshot resource.

Parameters

string $entryId
string $snapshotId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/entry-snapshot

getEntrySnapshots(string $entryId, Query $query = null)

Returns a ResourceArray object which contains EntrySnapshot resources.

Parameters

string $entryId
Query $query

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/entry-snapshots-collection

getExtension(string $extensionId)

Returns an Extension resource.

Parameters

string $extensionId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/ui-extensions/extension

getExtensions()

Returns a ResourceArray object containing Extension resources.

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/ui-extensions/extensions-collection

getLocale(string $localeId)

Returns a Locale resource.

Parameters

string $localeId

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/locales/locale

getLocales()

Returns a ResourceArray object containing Locale resources.

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/locales/locale-collection

at line 68
__construct(Client $client, string $spaceId, string $environmentId)

Parameters

Client $client
string $spaceId
string $environmentId

at line 95
getSpaceProxy()

Returns a proxy to a space resource.

Useful for all space-scoped operations.

at line 109
create(CreatableInterface $resource, string $resourceId = '', $parameters = [])

Persist a new resource in Contentful.

This is a convenience method which just forwards to Client::create(), but setting the space and environment keys to the current space and environment IDs in the parameters array.

Parameters

CreatableInterface $resource
string $resourceId
$parameters

See also

\Contentful\Management\Client::create()

Resolves a Contentful link scoped to the current space and environment.

Parameters

Link $link
array $parameters

at line 137
toResource()

Returns the Environment resource which corresponds to this proxy.

See also

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/environments/environment