Skip to content
Snippets Groups Projects
Commit 292cc96d authored by mindaugasd's avatar mindaugasd
Browse files

Issue #3441127 by mindaugasd: Use NestedArray utility instead of custom solution: fix

parent 98a3209f
No related branches found
No related merge requests found
Pipeline #149041 passed
......@@ -167,6 +167,9 @@ class AIChat extends ContentEntityBase implements EntityChangedInterface, Entity
* {@inheritdoc}
*/
public function getDataNestedValue(mixed $key): mixed {
if (empty($this->data_cache)) {
return NULL;
}
return NestedArray::getValue($this->data_cache, (array) $key);
}
......@@ -174,6 +177,9 @@ class AIChat extends ContentEntityBase implements EntityChangedInterface, Entity
* {@inheritdoc}
*/
public function setDataNestedValue(mixed $key, mixed $value, bool $save = TRUE): void {
if (empty($this->data_cache)) {
$this->data_cache = [];
}
NestedArray::setValue($this->data_cache, (array) $key, $value, TRUE);
if ($value === NULL) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment