From c6abe1667b0285ed219debb2377cab9fed50d49a Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Wed, 6 Nov 2024 11:00:47 +0100 Subject: [PATCH 1/3] Fix regression from #875 --- src/GraphQL/Service.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GraphQL/Service.php b/src/GraphQL/Service.php index ae90ff98..b52fb5e4 100644 --- a/src/GraphQL/Service.php +++ b/src/GraphQL/Service.php @@ -782,6 +782,9 @@ public function getPropertyTypeDefinition($typeName) * @param string|null $brickType * @param string|null $brickKey * @param Data|null $fieldDefinition + * @param array $context + * @param array|null $brickDescriptor + * @param array $args * * @return stdclass, value and objectid where the value comes from */ @@ -1162,7 +1165,7 @@ public static function getValueFromObjectBrick( Concrete $object, string $brickType, string $brickKey, - string $brickDescriptor = null, + ?array $brickDescriptor = null, array $descriptorData = [], ): stdClass|array|null { $context = ['object' => $object]; From 301b02a23e2a0ae00c09a88a390272127a1c4906 Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Wed, 6 Nov 2024 14:17:07 +0100 Subject: [PATCH 2/3] getValueForObject/getValueFromObjectBrick returns mixed --- src/GraphQL/Service.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/GraphQL/Service.php b/src/GraphQL/Service.php index b52fb5e4..36b1ceeb 100644 --- a/src/GraphQL/Service.php +++ b/src/GraphQL/Service.php @@ -786,7 +786,7 @@ public function getPropertyTypeDefinition($typeName) * @param array|null $brickDescriptor * @param array $args * - * @return stdclass, value and objectid where the value comes from + * @return mixed */ public static function getValueForObject($object, $key, $brickType = null, $brickKey = null, $fieldDefinition = null, $context = [], $brickDescriptor = null, $args = []) { @@ -1167,7 +1167,7 @@ public static function getValueFromObjectBrick( string $brickKey, ?array $brickDescriptor = null, array $descriptorData = [], - ): stdClass|array|null { + ): mixed { $context = ['object' => $object]; $key = \Pimcore\Model\DataObject\Service::getFieldForBrickType($object->getclass(), $brickType); @@ -1191,7 +1191,8 @@ public static function getValueFromObjectBrick( $def, $context, $brickDescriptor, - $descriptorData['args'] ?? []); + $descriptorData['args'] ?? [] + ); } return null; From 53db706a4278e8cd91c16346d21ba31eedda532c Mon Sep 17 00:00:00 2001 From: Sebastian Blank Date: Wed, 6 Nov 2024 15:23:33 +0100 Subject: [PATCH 3/3] setValue return mixed --- src/GraphQL/Service.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GraphQL/Service.php b/src/GraphQL/Service.php index 36b1ceeb..0bc0b5c0 100644 --- a/src/GraphQL/Service.php +++ b/src/GraphQL/Service.php @@ -53,7 +53,6 @@ use Pimcore\Model\Factory; use Pimcore\Translation\Translator; use Psr\Container\ContainerInterface; -use stdClass; class Service { @@ -841,7 +840,7 @@ public static function getValueForObject($object, $key, $brickType = null, $bric * @param string $attribute * @param \Closure $callback * - * @return stdclass|null + * @return mixed result of the callback * * @throws \Exception */