Skip to content

Commit 559127b

Browse files
committed
Use filterScalarValues method
1 parent d37c09a commit 559127b

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Form/DataTransformer/Entity/AbstractEntityTransformer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
namespace Ecommit\JavascriptBundle\Form\DataTransformer\Entity;
1212

1313
use Doctrine\ORM\QueryBuilder;
14+
use Ecommit\UtilBundle\Util\Util;
1415
use Symfony\Component\Form\DataTransformerInterface;
1516
use Symfony\Component\PropertyAccess\PropertyAccess;
1617
use Symfony\Component\PropertyAccess\PropertyAccessor;
@@ -54,6 +55,7 @@ protected function init(QueryBuilder $queryBuilder, $identifier, $property)
5455
protected function getCacheHash($id)
5556
{
5657
if (is_array($id)) {
58+
$id = Util::filterScalarValues($id);
5759
$id = array_map(
5860
function ($child) {
5961
return (string)$child; //Converts ids from integer to string => Parameters for transform and reverse functions must be identicals

Form/DataTransformer/Entity/EntitiesToIdsTransformer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Doctrine\Common\Collections\ArrayCollection;
1414
use Doctrine\Common\Collections\Collection;
1515
use Doctrine\ORM\QueryBuilder;
16+
use Ecommit\UtilBundle\Util\Util;
1617
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
1718
use Symfony\Component\Form\Exception\TransformationFailedException;
1819
use Symfony\Component\Form\Exception\UnexpectedTypeException;
@@ -78,6 +79,7 @@ public function reverseTransform($values)
7879
if (!is_array($values)) {
7980
throw new UnexpectedTypeException($values, 'array');
8081
}
82+
$values = Util::filterScalarValues($values);
8183

8284
if (count($values) == 0) {
8385
return $collection;

0 commit comments

Comments
 (0)