File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1313use Doctrine \Common \Persistence \ManagerRegistry ;
1414use Doctrine \ORM \NoResultException ;
1515use Harmony \Component \ModularRouting \Manager \ModuleManagerInterface ;
16+ use Harmony \Component \ModularRouting \Model \ModularRepositoryInterface ;
1617use Sensio \Bundle \FrameworkExtraBundle \Configuration \ParamConverter as ParamConverterConfiguration ;
1718use Sensio \Bundle \FrameworkExtraBundle \Request \ParamConverter \DoctrineParamConverter ;
1819use Sensio \Bundle \FrameworkExtraBundle \Request \ParamConverter \ParamConverterInterface ;
@@ -116,11 +117,13 @@ public function supports(ParamConverterConfiguration $configuration)
116117 $ em = $ this ->getManager ($ options ['entity_manager ' ], $ configuration ->getClass ());
117118 $ repository = $ em ->getRepository ($ configuration ->getClass ());
118119
119- /**
120- * todo this is a temporary solution and a break point if the trait is not directly inherited. Currently no
121- * problems have arisen but it could be improved by introducing ModularRepositoryInterface.
122- */
123- return array_key_exists ('Harmony\Component\ModularRouting\Doctrine\ModularRepositoryTrait ' , class_uses ($ repository ));
120+ if (!$ repository instanceof ModularRepositoryInterface) {
121+ return false ;
122+ }
123+
124+ $ metadata = $ em ->getClassMetadata ($ configuration ->getClass ());
125+
126+ return $ metadata ->hasField ('module ' );
124127 }
125128
126129 private function getManager ($ name , $ class )
You can’t perform that action at this time.
0 commit comments