class Entry extends LocalizedResource implements EntryInterface, ArrayAccess

Traits

Properties

protected string[] $localeCodes List of codes for all the locales available in the space this resource belongs to. from LocalizedResource
protected Entry $sys
protected Tag[] $tags from TagTrait
protected array $fields
protected ClientInterface $client
protected bool $disableTags

Methods

__construct(array $data)

Resources in this SDK should not be built using $new Class().

asLink()

{@inheritdoc}

getId()

{@inheritdoc}

getType()

{@inheritdoc}

initLocales(array $locales)

No description

$this
setLocale(Locale|string $locale)

Set the locale for this instance.

getLocale()

The locale code for the currently set locale.

getLocaleFromInput(Locale|string|null $input = null)

No description

string|null
walkFallbackChain(array $valueMap, string $localeCode, Environment $environment)

No description

initTags(array $tags)

Initialize an entries tags.

jsonSerializeSpace()

No description

from TagTrait
getTags()

Get all tags of the entry.

getSystemProperties()

{@inheritdoc}

getSpace()

Returns the space this entry belongs to.

getEnvironment()

Returns the environment this entry belongs to.

getContentType()

No description

mixed
__call(string $name, array $arguments)

No description

mixed
__get(string $name)

Shortcut for accessing fields using $entry->fieldName.

offsetGet(mixed $name)

{@inheritdoc}

offsetExists(mixed $name)

{@inheritdoc}

offsetSet(mixed $name, mixed $value)

{@inheritdoc}

offsetUnset(mixed $name)

{@inheritdoc}

has(string $name, string $locale = null, bool $checkLinksAreResolved = true)

Checks whether the current entry has a field with a certain ID.

bool
__isset(string $name)

No description

all(string $locale = null, bool $resolveLinks = true, bool $ignoreLocaleForNonLocalizedFields = false)

Returns all fields of the current entry, with some optimizations applied.

bool
isFieldLocalized(string $name)

Returns true if the field contains locale dependent content.

mixed
get(string $name, string $locale = null, bool $resolveLinks = true)

Returns a the value of a field using the given locale.

getReferences(Query $query = null)

Gets all entries that contain links to the current one.

jsonSerialize()

{@inheritdoc}

Details

in BaseResource at line 24
protected __construct(array $data)

Resources in this SDK should not be built using $new Class().

This method is only useful in testing environments, where the resource needs to be subclasses and this method made public.

Parameters

array $data

{@inheritdoc}

in BaseResource at line 47
getId()

{@inheritdoc}

in BaseResource at line 55
getType()

{@inheritdoc}

in LocalizedResource at line 41
initLocales(array $locales)

Parameters

array $locales The locales available in the space this resource belongs to

in LocalizedResource at line 65
$this setLocale(Locale|string $locale)

Set the locale for this instance.

All future calls to a getter will return the information for this locale.

Parameters

Locale|string $locale The locale code as string or an instance of Locale

Return Value

$this

in LocalizedResource at line 77
getLocale()

The locale code for the currently set locale.

It will be either the default locale if the resource was fetched using "locale=*", or the one that was used in the API request.

in LocalizedResource at line 87
protected getLocaleFromInput(Locale|string|null $input = null)

Parameters

Locale|string|null $input

Exceptions

InvalidArgumentException when $locale is not one of the locales supported by the space

in LocalizedResource at line 113
protected string|null walkFallbackChain(array $valueMap, string $localeCode, Environment $environment)

Parameters

array $valueMap
string $localeCode
Environment $environment

Return Value

string|null the locale code for which a value can be found, or null if the end of the chain was reached

Exceptions

RuntimeException If we detect an endless loop

at line 412
initTags(array $tags)

Initialize an entries tags.

Parameters

array $tags the tags to set

in TagTrait at line 28
protected jsonSerializeSpace()

at line 434
getTags()

Get all tags of the entry.

at line 53
getSystemProperties()

{@inheritdoc}

at line 61
getSpace()

Returns the space this entry belongs to.

at line 69
getEnvironment()

Returns the environment this entry belongs to.

at line 74
getContentType()

at line 82
mixed __call(string $name, array $arguments)

Parameters

string $name
array $arguments

Return Value

mixed

at line 121
mixed __get(string $name)

Shortcut for accessing fields using $entry->fieldName.

It will use the locale currently defined.

Parameters

string $name

Return Value

mixed

at line 129
offsetGet(mixed $name)

{@inheritdoc}

Parameters

mixed $name

at line 137
offsetExists(mixed $name)

{@inheritdoc}

Parameters

mixed $name

at line 145
offsetSet(mixed $name, mixed $value)

{@inheritdoc}

Parameters

mixed $name
mixed $value

at line 153
offsetUnset(mixed $name)

{@inheritdoc}

Parameters

mixed $name

at line 161
has(string $name, string $locale = null, bool $checkLinksAreResolved = true)

Checks whether the current entry has a field with a certain ID.

Parameters

string $name
string $locale
bool $checkLinksAreResolved

at line 188
bool __isset(string $name)

Parameters

string $name

Return Value

bool

at line 204
all(string $locale = null, bool $resolveLinks = true, bool $ignoreLocaleForNonLocalizedFields = false)

Returns all fields of the current entry, with some optimizations applied.

Links are resolved by default. If you want to get raw link objects rather than complete resources, set the $resolveLinks parameter to false.

Parameters

string $locale the locale to access the fields with
bool $resolveLinks whether to resolve the links in the response
bool $ignoreLocaleForNonLocalizedFields Whether to access non-localized fields using the given locale. Unless this parameter is set, doing so will result in an exception. This behaviour is breaking to older versions and therefore not default.

at line 232
bool isFieldLocalized(string $name)

Returns true if the field contains locale dependent content.

Parameters

string $name the name of the field

Return Value

bool whether the given field is localized

at line 258
mixed get(string $name, string $locale = null, bool $resolveLinks = true)

Returns a the value of a field using the given locale.

It will also resolve links. If you want to access the ID of a link or of an array of links, simply append "Id" to the end of the $name parameter.

$author = $entry->get('author');
$id = $entry->get('authorId');

Parameters

string $name
string $locale
bool $resolveLinks

Return Value

mixed

at line 399
getReferences(Query $query = null)

Gets all entries that contain links to the current one.

You can provide a Query object in order to set parameters such as locale, include, and sorting.

Parameters

Query $query

at line 446
jsonSerialize()

{@inheritdoc}