You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I have next structure: Distribution (ApiResource, Document) -> Participant (EmbeddedDocument) -> Employee (Document)
When I try to search by "participants.employee" I get the exception: ApiPlatform\Doctrine\Odm\Filter\SearchFilter::getDoctrineFieldType(): Argument #1 ($property) must be of type string, null given, called in /srv/app/vendor/api-platform/core/src/Doctrine/Odm/Filter/SearchFilter.php on line 228
The code is partial for understanding the structure
Possible Solution
After research I found that the problem in next code point:
// vendor/api-platform/core/src/Doctrine/Odm/Filter/SearchFilter.php
$associationResourceClass = $metadata->getAssociationTargetClass($field); //contains Employee class name
$associationFieldIdentifier = $metadata->getIdentifierFieldNames()[0]; // null
$doctrineTypeField = $this->getDoctrineFieldType($associationFieldIdentifier, $associationResourceClass);
if (!$this->hasValidValues($values, $doctrineTypeField)) {
$this->logger->notice('Invalid filter ignored', [
'exception' => new InvalidArgumentException(sprintf('Values for field "%s" are not valid according to the doctrine type.', $property)),
]);
return;
}
$metadata contains the metadata of Participant class (embedded), but embedded should not contains the id
I think about two ways to solve it:
Don't check the ids values, but I am not sure that it is good idea
Get metadata for Employee class and after check the ids
The text was updated successfully, but these errors were encountered:
API Platform version(s) affected: 3.3.3
Description
I have next structure: Distribution (ApiResource, Document) -> Participant (EmbeddedDocument) -> Employee (Document)
When I try to search by "participants.employee" I get the exception:
ApiPlatform\Doctrine\Odm\Filter\SearchFilter::getDoctrineFieldType(): Argument #1 ($property) must be of type string, null given, called in /srv/app/vendor/api-platform/core/src/Doctrine/Odm/Filter/SearchFilter.php on line 228
How to reproduce
The code is partial for understanding the structure
Possible Solution
After research I found that the problem in next code point:
$metadata contains the metadata of Participant class (embedded), but embedded should not contains the id
I think about two ways to solve it:
The text was updated successfully, but these errors were encountered: