2
2
3
3
namespace think \ide \console ;
4
4
5
+ use Ergebnis \Classy \Constructs ;
5
6
use Exception ;
6
- use Symfony \Component \ClassLoader \ClassMapGenerator ;
7
7
use think \console \Command ;
8
8
use think \console \input \Argument ;
9
9
use think \console \input \Option ;
@@ -25,11 +25,11 @@ class ModelCommand extends Command
25
25
protected function configure ()
26
26
{
27
27
$ 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 ' );
33
33
}
34
34
35
35
public function handle ()
@@ -97,8 +97,10 @@ protected function loadModels()
97
97
foreach ($ this ->dirs as $ dir ) {
98
98
$ dir = $ this ->app ->getBasePath () . $ dir ;
99
99
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 ();
102
104
}
103
105
}
104
106
}
0 commit comments