class Entry extends LocalizedResource implements EntryInterface, ArrayAccess

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 array $fields
protected ClientInterface $client

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.

string
getLocale()

The locale code for the currently set locale.

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

No description

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

No description

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($name)

{@inheritdoc}

offsetExists($name)

{@inheritdoc}

offsetSet($name, $value)

{@inheritdoc}

offsetUnset($name)

{@inheritdoc}

bool
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

array
all(string $locale = \null, bool $resolveLinks = \true)

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

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

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

ResourceArray
getReferences(Query $query = \null)

Gets all entries that contain links to the current one.

jsonSerialize()

{@inheritdoc}

Details

in BaseResource at line 26
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 49
getId()

{@inheritdoc}

in BaseResource at line 57
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
string getLocale()

The locale code for the currently set locale.

Return Value

string

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

Parameters

Locale|string|null $input

Return Value

string

Exceptions

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

in LocalizedResource at line 128
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 42
getSystemProperties()

{@inheritdoc}

at line 52
Space getSpace()

Returns the space this entry belongs to.

Return Value

Space

at line 62
Environment getEnvironment()

Returns the environment this entry belongs to.

Return Value

Environment

at line 70
ContentType getContentType()

Return Value

ContentType

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

Parameters

string $name
array $arguments

Return Value

mixed

at line 122
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 130
offsetGet($name)

{@inheritdoc}

Parameters

$name

at line 138
offsetExists($name)

{@inheritdoc}

Parameters

$name

at line 146
offsetSet($name, $value)

{@inheritdoc}

Parameters

$name
$value

at line 154
offsetUnset($name)

{@inheritdoc}

Parameters

$name

at line 168
bool 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

Return Value

bool

at line 197
bool __isset(string $name)

Parameters

string $name

Return Value

bool

at line 212
array all(string $locale = \null, bool $resolveLinks = \true)

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
bool $resolveLinks

Return Value

array

at line 243
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 If set to false, links and array of links will not be resolved

Return Value

mixed

at line 401
ResourceArray 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

Return Value

ResourceArray

at line 412
jsonSerialize()

{@inheritdoc}