Skip to content

Commit 21080a5

Browse files
committed
Restore identifiers casting to integer when necessary
1 parent d4cfd02 commit 21080a5

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

features/bootstrap/FeatureContext.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ public function thereIsARelatedDummyWithFriends(int $nb)
732732
$relatedDummy2->setName('RelatedDummy without friends');
733733
$this->manager->persist($relatedDummy2);
734734
$this->manager->flush();
735+
$this->manager->clear();
735736
}
736737

737738
/**

src/Identifier/Normalizer/ChainIdentifierDenormalizer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public function denormalize($data, $class, $format = null, array $context = [])
6262
throw new InvalidIdentifierException(sprintf('Invalid identifier "%1$s", "%1$s" was not found.', $key));
6363
}
6464

65+
if (($type = $this->propertyMetadataFactory->create($class, $key)->getType()) && Type::BUILTIN_TYPE_INT === $type->getBuiltinType()) {
66+
$identifiers[$key] = (int) $identifiers[$key];
67+
continue;
68+
}
69+
6570
foreach ($this->identifierDenormalizers as $normalizer) {
6671
$metadata = $this->getIdentifierMetadata($class, $key);
6772

tests/Fixtures/TestBundle/Entity/ContainNonResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ContainNonResource
3030
/**
3131
* @var mixed
3232
*
33-
* @ORM\Column(type="integer")
33+
* @ORM\Column(type="string")
3434
* @ORM\Id
3535
* @ORM\GeneratedValue(strategy="AUTO")
3636
*/

tests/Fixtures/TestBundle/Entity/DummyFriend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class DummyFriend
5353
*
5454
* @return int
5555
*/
56-
public function getId()
56+
public function getId(): int
5757
{
5858
return $this->id;
5959
}

0 commit comments

Comments
 (0)