1111
1212namespace Symfony \Bridge \Doctrine \Form ;
1313
14- use Doctrine \Common \Persistence \ManagerRegistry as LegacyManagerRegistry ;
15- use Doctrine \Common \Persistence \Mapping \MappingException as LegacyCommonMappingException ;
16- use Doctrine \Common \Persistence \Proxy ;
1714use Doctrine \DBAL \Types \Type ;
1815use Doctrine \ORM \Mapping \ClassMetadataInfo ;
1916use Doctrine \ORM \Mapping \MappingException as LegacyMappingException ;
2017use Doctrine \Persistence \ManagerRegistry ;
2118use Doctrine \Persistence \Mapping \MappingException ;
19+ use Doctrine \Persistence \Proxy ;
2220use Symfony \Component \Form \FormTypeGuesserInterface ;
2321use Symfony \Component \Form \Guess \Guess ;
2422use Symfony \Component \Form \Guess \TypeGuess ;
@@ -30,10 +28,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
3028
3129 private $ cache = [];
3230
33- /**
34- * @param ManagerRegistry|LegacyManagerRegistry $registry
35- */
36- public function __construct ($ registry )
31+ public function __construct (ManagerRegistry $ registry )
3732 {
3833 $ this ->registry = $ registry ;
3934 }
@@ -187,8 +182,6 @@ protected function getMetadata($class)
187182 return $ this ->cache [$ class ] = [$ em ->getClassMetadata ($ class ), $ name ];
188183 } catch (MappingException $ e ) {
189184 // not an entity or mapped super class
190- } catch (LegacyCommonMappingException $ e ) {
191- // not an entity or mapped super class
192185 } catch (LegacyMappingException $ e ) {
193186 // not an entity or mapped super class, using Doctrine ORM 2.2
194187 }
@@ -199,12 +192,10 @@ protected function getMetadata($class)
199192
200193 private static function getRealClass (string $ class ): string
201194 {
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 .'\\' )) {
205196 return $ class ;
206197 }
207198
208- return substr ($ class , $ pos + \strlen ( $ marker ) );
199+ return substr ($ class , $ pos + Proxy:: MARKER_LENGTH + 2 );
209200 }
210201}
0 commit comments