Skip to content

Commit

Permalink
IBX-7911: Replaced usage of magic getters for load subtree code paths (
Browse files Browse the repository at this point in the history
…#76)

For more details see https://issues.ibexa.co/browse/IBX-7911 and #76

Key changes:

* Introduced Value Object strict getters and deprecated magic ones

---------

Co-authored-by: Konrad Oboza <[email protected]>
  • Loading branch information
alongosz and konradoboza authored Jun 5, 2024
1 parent e9c1c3f commit 36ee5cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/Strategy/DefaultThumbnailStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ private function getInitials(array $fields): string
foreach ($this->initialsFieldDefIdentifiers as $identifier) {
/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */
foreach ($fields as $field) {
if ($field->fieldDefIdentifier === $identifier) {
$initials .= substr((string)$field->value, 0, 1);
if ($field->getFieldDefinitionIdentifier() === $identifier) {
$initials .= substr((string)$field->getValue(), 0, 1);
}
}
}
Expand Down
28 changes: 24 additions & 4 deletions src/lib/UserSetting/UserSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
use Ibexa\Contracts\Core\Repository\Values\ValueObject;

/**
* @property string $identifier
* @property string $name
* @property string $description
* @property string $value
* @property string $identifier @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see UserSetting::getIdentifier()} instead.
* @property string $name @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see UserSetting::getName()} instead.
* @property string $description @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see UserSetting::getDescription()} instead.
* @property string $value @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see UserSetting::getValue()} instead.
*/
class UserSetting extends ValueObject
{
Expand All @@ -29,6 +29,26 @@ class UserSetting extends ValueObject

/** @var string */
protected $value;

public function getIdentifier(): string
{
return $this->identifier;
}

public function getName(): string
{
return $this->name;
}

public function getDescription(): string
{
return $this->description;
}

public function getValue(): string
{
return $this->value;
}
}

class_alias(UserSetting::class, 'EzSystems\EzPlatformUser\UserSetting\UserSetting');

0 comments on commit 36ee5cd

Please sign in to comment.