13
13
14
14
use Doctrine \Common \Persistence \ManagerRegistry ;
15
15
use Doctrine \Common \Persistence \Mapping \MappingException ;
16
+ use Doctrine \Common \Persistence \Proxy ;
16
17
use Doctrine \DBAL \Types \Type ;
17
18
use Doctrine \ORM \Mapping \ClassMetadataInfo ;
18
19
use Doctrine \ORM \Mapping \MappingException as LegacyMappingException ;
19
20
use Symfony \Component \Form \FormTypeGuesserInterface ;
20
21
use Symfony \Component \Form \Guess \Guess ;
21
22
use Symfony \Component \Form \Guess \TypeGuess ;
22
23
use Symfony \Component \Form \Guess \ValueGuess ;
23
- use Doctrine \Common \Util \ClassUtils ;
24
24
25
25
class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
26
26
{
@@ -162,7 +162,7 @@ public function guessPattern($class, $property)
162
162
protected function getMetadata ($ class )
163
163
{
164
164
// normalize class name
165
- $ class = ClassUtils ::getRealClass (ltrim ($ class , '\\' ));
165
+ $ class = self ::getRealClass (ltrim ($ class , '\\' ));
166
166
167
167
if (array_key_exists ($ class , $ this ->cache )) {
168
168
return $ this ->cache [$ class ];
@@ -179,4 +179,13 @@ protected function getMetadata($class)
179
179
}
180
180
}
181
181
}
182
+
183
+ private static function getRealClass (string $ class ): string
184
+ {
185
+ if (false === $ pos = strrpos ($ class , '\\' .Proxy::MARKER .'\\' )) {
186
+ return $ class ;
187
+ }
188
+
189
+ return substr ($ class , $ pos + Proxy::MARKER_LENGTH + 2 );
190
+ }
182
191
}
0 commit comments