Skip to content

Commit 36ee5cd

Browse files
IBX-7911: Replaced usage of magic getters for load subtree code paths (#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]>
1 parent e9c1c3f commit 36ee5cd

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/lib/Strategy/DefaultThumbnailStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ private function getInitials(array $fields): string
5757
foreach ($this->initialsFieldDefIdentifiers as $identifier) {
5858
/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */
5959
foreach ($fields as $field) {
60-
if ($field->fieldDefIdentifier === $identifier) {
61-
$initials .= substr((string)$field->value, 0, 1);
60+
if ($field->getFieldDefinitionIdentifier() === $identifier) {
61+
$initials .= substr((string)$field->getValue(), 0, 1);
6262
}
6363
}
6464
}

src/lib/UserSetting/UserSetting.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
use Ibexa\Contracts\Core\Repository\Values\ValueObject;
1212

1313
/**
14-
* @property string $identifier
15-
* @property string $name
16-
* @property string $description
17-
* @property string $value
14+
* @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.
15+
* @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.
16+
* @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.
17+
* @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.
1818
*/
1919
class UserSetting extends ValueObject
2020
{
@@ -29,6 +29,26 @@ class UserSetting extends ValueObject
2929

3030
/** @var string */
3131
protected $value;
32+
33+
public function getIdentifier(): string
34+
{
35+
return $this->identifier;
36+
}
37+
38+
public function getName(): string
39+
{
40+
return $this->name;
41+
}
42+
43+
public function getDescription(): string
44+
{
45+
return $this->description;
46+
}
47+
48+
public function getValue(): string
49+
{
50+
return $this->value;
51+
}
3252
}
3353

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

0 commit comments

Comments
 (0)