Skip to content
This repository was archived by the owner on Sep 15, 2022. It is now read-only.

Commit fcd824b

Browse files
Albin KerouantonAlbin Kerouanton
authored andcommitted
Merge pull request #161 from teohhanhui/patch-2
Support json_array and simple_array Doctrine DBAL types
2 parents 41f3836 + d15f909 commit fcd824b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/Knp/FriendlyContexts/Doctrine/EntityHydrator.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
namespace Knp\FriendlyContexts\Doctrine;
44

5-
use Doctrine\ORM\Mapping\ClassMetadata;
6-
use Symfony\Component\PropertyAccess\PropertyAccess;
75
use Doctrine\Common\Collections\ArrayCollection;
8-
use Knp\FriendlyContexts\Utils\TextFormater;
9-
use Knp\FriendlyContexts\Guesser\GuesserManager;
106
use Doctrine\Common\Persistence\ObjectManager;
7+
use Doctrine\DBAL\Types\Type as DBALType;
8+
use Doctrine\ORM\Mapping\ClassMetadata;
9+
use Knp\FriendlyContexts\Guesser\GuesserManager;
10+
use Knp\FriendlyContexts\Utils\TextFormater;
1111
use Knp\FriendlyContexts\Utils\UniqueCache;
12+
use Symfony\Component\PropertyAccess\PropertyAccess;
1213

1314
class EntityHydrator
1415
{
@@ -113,7 +114,7 @@ protected function formatFromMapping($mapping, &$property, &$value)
113114
{
114115
$property = $mapping['fieldName'];
115116
$collectionRelation = in_array($mapping['type'], [ClassMetadata::ONE_TO_MANY, ClassMetadata::MANY_TO_MANY]);
116-
$arrayRelation = $mapping['type'] === 'array';
117+
$arrayRelation = in_array($mapping['type'], [DBALType::TARRAY, DBALType::SIMPLE_ARRAY, DBALType::JSON_ARRAY]);
117118

118119
if ($collectionRelation || $arrayRelation) {
119120
$result = array_map(

0 commit comments

Comments
 (0)