EnvironmentProxy
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
Properties
Client | $client | from EnvironmentProxyExtension |
Methods
{@inheritdoc}
{@inheritdoc}
Returns a ContentType resource.
Returns a ResourceArray object which contains ContentType resources.
Returns a published ContentType resource.
Returns a ResourceArray object which contains published ContentType resources.
Returns a ContentTypeSnapshot resource.
Returns a ResourceArray object which contains ContentTypeSnapshot resources.
Returns an EditorInterface resource.
Returns a EntrySnapshot resource.
Returns a ResourceArray object which contains EntrySnapshot resources.
Returns a ResourceArray object containing Extension resources.
Returns a ResourceArray object containing Locale resources.
Returns a proxy to a space resource.
Persist a new resource in Contentful.
Resolves a Contentful link scoped to the current space and environment.
Returns the Environment resource which corresponds to this proxy.
Details
at line 78
protected
getSpaceId()
{@inheritdoc}
at line 86
protected
getEnvironmentId()
{@inheritdoc}
in EnvironmentProxyExtension at line 56
getAsset(string $assetId)
Returns an Asset resource.
in EnvironmentProxyExtension at line 70
getAssets(Query $query = null)
Returns a ResourceArray object which contains Asset resources.
in EnvironmentProxyExtension at line 84
getContentType(string $contentTypeId)
Returns a ContentType resource.
in EnvironmentProxyExtension at line 98
getContentTypes(Query $query = null)
Returns a ResourceArray object which contains ContentType resources.
in EnvironmentProxyExtension at line 112
getPublishedContentType(string $contentTypeId)
Returns a published ContentType resource.
in EnvironmentProxyExtension at line 126
getPublishedContentTypes(Query $query = null)
Returns a ResourceArray object which contains published ContentType resources.
in EnvironmentProxyExtension at line 140
getContentTypeSnapshot(string $contentTypeId, string $snapshotId)
Returns a ContentTypeSnapshot resource.
in EnvironmentProxyExtension at line 155
getContentTypeSnapshots(string $contentTypeId, Query $query = null)
Returns a ResourceArray object which contains ContentTypeSnapshot resources.
in EnvironmentProxyExtension at line 170
getEditorInterface(string $contentTypeId)
Returns an EditorInterface resource.
in EnvironmentProxyExtension at line 184
getEntry(string $entryId)
Returns an Entry resource.
in EnvironmentProxyExtension at line 198
getEntries(Query $query = null)
Returns a ResourceArray object which contains Entry resources.
in EnvironmentProxyExtension at line 212
getEntrySnapshot(string $entryId, string $snapshotId)
Returns a EntrySnapshot resource.
in EnvironmentProxyExtension at line 227
getEntrySnapshots(string $entryId, Query $query = null)
Returns a ResourceArray object which contains EntrySnapshot resources.
in EnvironmentProxyExtension at line 242
getExtension(string $extensionId)
Returns an Extension resource.
in EnvironmentProxyExtension at line 256
getExtensions()
Returns a ResourceArray object containing Extension resources.
in EnvironmentProxyExtension at line 269
getLocale(string $localeId)
Returns a Locale resource.
in EnvironmentProxyExtension at line 283
getLocales()
Returns a ResourceArray object containing Locale resources.
at line 68
__construct(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.
at line 124
resolveLink(Link $link, array $parameters = [])
Resolves a Contentful link scoped to the current space and environment.
at line 137
toResource()
Returns the Environment resource which corresponds to this proxy.