8000 [DoctrineBridge] Fix data extraction in relation using IndexBy and different column name by bwach · Pull Request #38883 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineBridge] Fix data extraction in relation using IndexBy and different column name #38883

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

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
8000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix for issue 38861
  • Loading branch information
Bart Wach committed Oct 29, 2020
commit c57530bade941edd5d2702edc6eb8317edafe984
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ public function getTypes($class, $property, array $context = [])
$associationMapping = $metadata->getAssociationMapping($property);

if (isset($associationMapping['indexBy'])) {
$indexColumn = $associationMapping['indexBy'];
$indexField = $associationMapping['indexBy'];
/** @var ClassMetadataInfo $subMetadata */
$subMetadata = $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
$typeOfField = $subMetadata->getTypeOfField($subMetadata->getFieldForColumn($indexColumn));

$typeOfField = $subMetadata->getTypeOfField($indexField);

if (!$typeOfField) {
$typeOfField = $subMetadata->getTypeOfField($subMetadata->getFieldForColumn($indexField));
}

if (!$collectionKeyType = $this->getPhpType($typeOfField)) {
return null;
Expand Down
0