Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/composite identifiers 5396 #5589

Merged
merged 2 commits into from
May 22, 2023

Conversation

Sarahshr
Copy link
Contributor

Q A
Branch? 3.1
Tickets #5396
License MIT

This PR allows composite identifiers with differents types

@Sarahshr Sarahshr force-pushed the fix/composite-identifiers-5396 branch from 39efdff to 0c0b1bc Compare May 16, 2023 08:42
features/main/composite.feature Outdated Show resolved Hide resolved
@Sarahshr Sarahshr force-pushed the fix/composite-identifiers-5396 branch 4 times, most recently from 15e5aeb to 137a414 Compare May 16, 2023 14:54
@Sarahshr Sarahshr force-pushed the fix/composite-identifiers-5396 branch from 137a414 to a9c434a Compare May 16, 2023 15:09
@soyuka soyuka merged commit 547078c into api-platform:3.1 May 22, 2023
@soyuka
Copy link
Member

soyuka commented May 22, 2023

@@ -71,7 +73,7 @@ private function getIdentifierTypes(string $resourceClass, array $properties): a
foreach ($properties as $property) {
$propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $property);
foreach ($propertyMetadata->getBuiltinTypes() as $type) {
$types[] = Type::BUILTIN_TYPE_OBJECT === ($builtinType = $type->getBuiltinType()) ? $type->getClassName() : $builtinType;
$types[$property][] = Type::BUILTIN_TYPE_OBJECT === ($builtinType = $type->getBuiltinType()) ? $type->getClassName() : $builtinType;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the issue, this PR makes an assumption that the parameterName is always in sync with properties, which is not the case as shown here https://github.com/api-platform/core/blob/main/tests/Fixtures/TestBundle/Resources/config/api_resources_odm/resources.xml#L14

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants