Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
When calling with lazy loading the Sql generated doesn't convert the parameters according to their types. After debugging the problem I found that the problem is in the getType($field, $value) function in the BasicEntityPersister as it is it will never be able to return the filed type when called for lazy loading for oneToMany or ManyToMany. I put a quick fix for my self
private function getType($field, $value) { switch (true) { //here we have original code default: $type = null; // my fix starts here $fieldParts = explode('.', $field); if (count($fieldParts > 1)) { foreach ($this->_class->associationMappings as $mapping) { if (isset($mapping['joinColumnFieldNames'][$fieldParts[1]])) { $targetClass = $this->_em->getClassMetadata($mapping['targetEntity']); if (isset($targetClass->fieldNames[$fieldParts[1]])) { $type = $targetClass->fieldMappings[$targetClass->fieldNames[$fieldParts[1]]]['type']; } break; } } } //my fix end here } //here we have original code return $type; }
i have only added that check in the default case of the switch. I am not sure if that is the most elegant way. I hope that helps and that it will be fixed soon. Thanks for the great work
.
Fabio B. Silva Guilherme Blanco do we have a current best practice/policy regarding casting of join column types? There are some issues regarding it, this is another one.