File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ private function preloadManyToManyInner(
331331 ->andWhere ('source IN (:sourceEntityIds) ' )
332332 ->setParameter (
333333 'sourceEntityIds ' ,
334- $ uninitializedSourceEntityIdsChunk ,
334+ $ this -> convertFieldValuesToDatabaseValues ( $ sourceIdentifierType , $ uninitializedSourceEntityIdsChunk) ,
335335 $ this ->deduceArrayParameterType ($ sourceIdentifierType ),
336336 )
337337 ->getQuery ()
@@ -444,7 +444,7 @@ private function loadEntitiesBy(
444444 ->andWhere ("{$ rootLevelAlias }. {$ fieldName } IN (:fieldValues) " )
445445 ->setParameter (
446446 'fieldValues ' ,
447- $ fieldValues ,
447+ $ this -> convertFieldValuesToDatabaseValues ( $ referencedType , $ fieldValues) ,
448448 $ this ->deduceArrayParameterType ($ referencedType ),
449449 );
450450
@@ -468,6 +468,26 @@ private function deduceArrayParameterType(Type $dbalType): ArrayParameterType|in
468468 };
469469 }
470470
471+ /**
472+ * @param array<mixed> $fieldValues
473+ * @return list<mixed>
474+ */
475+ private function convertFieldValuesToDatabaseValues (
476+ Type $ dbalType ,
477+ array $ fieldValues ,
478+ ): array
479+ {
480+ $ connection = $ this ->entityManager ->getConnection ();
481+ $ platform = $ connection ->getDatabasePlatform ();
482+
483+ $ convertedValues = [];
484+ foreach ($ fieldValues as $ value ) {
485+ $ convertedValues [] = $ dbalType ->convertToDatabaseValue ($ value , $ platform );
486+ }
487+
488+ return $ convertedValues ;
489+ }
490+
471491 /**
472492 * @param ClassMetadata<C> $classMetadata
473493 *
You can’t perform that action at this time.
0 commit comments