11
11
12
12
namespace Symfony \Bridge \Doctrine \Form ;
13
13
14
- use Doctrine \Common \Persistence \ManagerRegistry as LegacyManagerRegistry ;
15
- use Doctrine \Common \Persistence \Mapping \MappingException as LegacyCommonMappingException ;
16
- use Doctrine \Common \Persistence \Proxy ;
17
14
use Doctrine \DBAL \Types \Type ;
18
15
use Doctrine \ORM \Mapping \ClassMetadataInfo ;
19
16
use Doctrine \ORM \Mapping \MappingException as LegacyMappingException ;
20
17
use Doctrine \Persistence \ManagerRegistry ;
21
18
use Doctrine \Persistence \Mapping \MappingException ;
19
+ use Doctrine \Persistence \Proxy ;
22
20
use Symfony \Component \Form \FormTypeGuesserInterface ;
23
21
use Symfony \Component \Form \Guess \Guess ;
24
22
use Symfony \Component \Form \Guess \TypeGuess ;
@@ -30,10 +28,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
30
28
31
29
private $ cache = [];
32
30
33
- /**
34
- * @param ManagerRegistry|LegacyManagerRegistry $registry
35
- */
36
- public function __construct ($ registry )
31
+ public function __construct (ManagerRegistry $ registry )
37
32
{
38
33
$ this ->registry = $ registry ;
39
34
}
@@ -187,8 +182,6 @@ protected function getMetadata($class)
187
182
return $ this ->cache [$ class ] = [$ em ->getClassMetadata ($ class ), $ name ];
188
183
} catch (MappingException $ e ) {
189
184
// not an entity or mapped super class
190
- } catch (LegacyCommonMappingException $ e ) {
191
- // not an entity or mapped super class
192
185
} catch (LegacyMappingException $ e ) {
193
186
// not an entity or mapped super class, using Doctrine ORM 2.2
194
187
}
@@ -199,12 +192,10 @@ protected function getMetadata($class)
199
192
200
193
private static function getRealClass (string $ class ): string
201
194
{
202
- $ marker = interface_exists (Proxy::class) ? '\\' .Proxy::MARKER .'\\' : '\__CG__ \\' ;
203
-
204
- if (false === $ pos = strrpos ($ class , $ marker )) {
195
+ if (false === $ pos = strrpos ($ class , '\\' .Proxy::MARKER .'\\' )) {
205
196
return $ class ;
206
197
}
207
198
208
- return substr ($ class , $ pos + \strlen ( $ marker ) );
199
+ return substr ($ class , $ pos + Proxy:: MARKER_LENGTH + 2 );
209
200
}
210
201
}
0 commit comments