22
33namespace think \ide \console ;
44
5+ use Ergebnis \Classy \Constructs ;
56use Exception ;
6- use Symfony \Component \ClassLoader \ClassMapGenerator ;
77use think \console \Command ;
88use think \console \input \Argument ;
99use think \console \input \Option ;
@@ -25,11 +25,11 @@ class ModelCommand extends Command
2525 protected function configure ()
2626 {
2727 $ this ->setName ("ide-helper:model " )
28- ->addArgument ('model ' , Argument::OPTIONAL | Argument::IS_ARRAY , 'Which models to include ' , [])
29- ->addOption ('dir ' , 'D ' , Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY , 'The model dir ' , [])
30- ->addOption ('ignore ' , 'I ' , Option::VALUE_OPTIONAL , 'Which models to ignore ' , '' )
31- ->addOption ('reset ' , 'R ' , Option::VALUE_NONE , 'Remove the original phpdocs instead of appending ' )
32- ->addOption ('overwrite ' , 'O ' , Option::VALUE_NONE , 'Overwrite the phpdocs ' );
28+ ->addArgument ('model ' , Argument::OPTIONAL | Argument::IS_ARRAY , 'Which models to include ' , [])
29+ ->addOption ('dir ' , 'D ' , Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY , 'The model dir ' , [])
30+ ->addOption ('ignore ' , 'I ' , Option::VALUE_OPTIONAL , 'Which models to ignore ' , '' )
31+ ->addOption ('reset ' , 'R ' , Option::VALUE_NONE , 'Remove the original phpdocs instead of appending ' )
32+ ->addOption ('overwrite ' , 'O ' , Option::VALUE_NONE , 'Overwrite the phpdocs ' );
3333 }
3434
3535 public function handle ()
@@ -97,8 +97,10 @@ protected function loadModels()
9797 foreach ($ this ->dirs as $ dir ) {
9898 $ dir = $ this ->app ->getBasePath () . $ dir ;
9999 if (file_exists ($ dir )) {
100- foreach (ClassMapGenerator::createMap ($ dir ) as $ model => $ path ) {
101- $ models [] = $ model ;
100+ $ constructs = Constructs::fromDirectory ($ dir );
101+
102+ foreach ($ constructs as $ construct ) {
103+ $ models [] = $ construct ->name ();
102104 }
103105 }
104106 }
0 commit comments