Skip to content

Commit 2df522b

Browse files
committed
Fix bug introduced by APIP 4.3.3
1 parent 91b88cf commit 2df522b

7 files changed

Lines changed: 14 additions & 12 deletions

File tree

.symfony.insight.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
php_version: 8.4
1+
php_version: 8.5
22
rules:
33
doctrine.public_doctrine_property:
44
enabled: false

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=8.4",
21+
"php": ">=8.5",
2222
"ext-exif": "*",
2323
"ext-fileinfo": "*",
2424
"ext-json": "*",

features/bootstrap/DoctrineContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ public function thereIsADummyComponent(): DummyComponent
298298
}
299299

300300
/**
301-
* @Given(removed as was not used in features, only internal) there is a DummyPublishableComponent
301+
* @Given there is a DummyPublishableComponent
302302
*/
303303
public function thereIsADummyPublishableComponent(): DummyPublishableComponent
304304
{
@@ -387,7 +387,7 @@ public function thereIsAComponentGroupWithComponents(int $count, ?string $id = n
387387
if ($id) {
388388
$reflection = new \ReflectionClass($componentGroup);
389389
$reflectionProp = $reflection->getProperty('id');
390-
$reflectionProp->setAccessible(true);
390+
// $reflectionProp->setAccessible(true);
391391
$reflectionProp->setValue($componentGroup, Uuid::fromString($id));
392392
$this->manager->flush();
393393
$repo = $this->manager->getRepository(ComponentGroup::class);

features/main/component_groups.feature

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,16 @@ Feature: ComponentGroup resource
5959
Scenario: I can add a component collection to pages and layouts
6060
Given there is a Page
6161
And there is a Layout
62-
And there is a DummyComponent
62+
And there is a DummyPublishableComponent
6363
When I send a "POST" request to "/_/component_groups" with data:
64-
| reference | location | pages | layouts | components |
65-
| main_body | main | json_decode([ "resource[page]" ]) | json_decode([ "resource[layout]" ]) | json_decode([ "resource[dummy_component]" ]) |
64+
| reference | location | pages | layouts | components |
65+
| main_body | resource[dummy_publishable_component] | json_decode([ "resource[page]" ]) | json_decode([ "resource[layout]" ]) | json_decode([ "resource[dummy_publishable_component]" ]) |
6666
Then the response status code should be 201
6767
And the JSON should be valid according to the schema file "component_group.schema.json"
6868
And the JSON node "pages[0]" should be equal to the IRI of the resource "page"
6969
And the JSON node "layouts[0]" should be equal to the IRI of the resource "layout"
70-
And the JSON node "components[0]" should be equal to the IRI of the resource "dummy_component"
70+
And the JSON node "location" should be equal to the IRI of the resource "dummy_publishable_component"
71+
And the JSON node "components[0]" should be equal to the IRI of the resource "dummy_publishable_component"
7172

7273
@loginAdmin
7374
Scenario: If a component group is orphaned it should be deleted

src/Entity/User/AbstractUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public static function createFromPayload($username, array $payload): JWTUserInte
404404

405405
$reflection = new \ReflectionClass(static::class);
406406
$idProperty = $reflection->getProperty('id');
407-
$idProperty->setAccessible(true);
407+
// $idProperty->setAccessible(true);
408408
$idProperty->setValue($newUser, Uuid::fromString($payload['id']));
409409

410410
return $newUser;

src/EventListener/Api/PublishableEventListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ private function mergeDraftIntoPublished(string $identifierFieldName, object $dr
230230
}
231231

232232
foreach ($properties as $property) {
233-
$property->setAccessible(true);
233+
// $property->setAccessible(true);
234234
$name = $property->getName();
235235
if ($identifierFieldName === $name) {
236236
continue;
237237
}
238238
$draftProperty = $draftReflection->hasProperty($name) ? $draftReflection->getProperty($name) : null;
239239
if ($draftProperty) {
240-
$draftProperty->setAccessible(true);
240+
// $draftProperty->setAccessible(true);
241241
$draftValue = $draftProperty->getValue($draftResource);
242242
$property->setValue($publishedResource, $draftValue);
243243
}

src/Serializer/Normalizer/PublishableNormalizer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
*/
4646
final class PublishableNormalizer implements NormalizerInterface, NormalizerAwareInterface, DenormalizerInterface, DenormalizerAwareInterface
4747
{
48+
use DenormalizerAwareTrait;
4849
use DenormalizerAwareTrait;
4950
use NormalizerAwareTrait;
5051

@@ -258,7 +259,7 @@ public function createDraft(object $object, Publishable $configuration, string $
258259
*/
259260
public function supportsDenormalization($data, $type, $format = null, array $context = []): bool
260261
{
261-
return !isset($context[self::ALREADY_CALLED]) && $this->publishableStatusChecker->getAttributeReader()->isConfigured($type);
262+
return !isset($context[self::ALREADY_CALLED]) && $this->publishableStatusChecker->getAttributeReader()->isConfigured($type) && is_array($data);
262263
}
263264

264265
private function getManagerFromType(string $type): ObjectManager

0 commit comments

Comments
 (0)