2121use Symfony \Bundle \MakerBundle \Doctrine \DoctrineHelper ;
2222use Symfony \Bundle \MakerBundle \Exception \RuntimeCommandException ;
2323use Symfony \Bundle \MakerBundle \Generator ;
24- use Symfony \Bundle \MakerBundle \GeneratorAwareMakerInterface ;
2524use Symfony \Bundle \MakerBundle \InputAwareMakerInterface ;
2625use Symfony \Bundle \MakerBundle \InputConfiguration ;
2726use Symfony \Bundle \MakerBundle \Str ;
4342 * @author Ryan Weaver <[email protected] > 4443 * @author Kévin Dunglas <[email protected] > 4544 */
46- final class MakeEntity extends AbstractMaker implements InputAwareMakerInterface, GeneratorAwareMakerInterface
45+ final class MakeEntity extends AbstractMaker implements InputAwareMakerInterface
4746{
4847 private $ fileManager ;
4948 private $ doctrineHelper ;
5049 private $ projectDirectory ;
50+ private $ generator ;
5151
52- public function __construct (FileManager $ fileManager , string $ projectDirectory , DoctrineHelper $ doctrineHelper )
52+ public function __construct (FileManager $ fileManager , string $ projectDirectory , DoctrineHelper $ doctrineHelper, Generator $ generator = null )
5353 {
5454 $ this ->fileManager = $ fileManager ;
5555 $ this ->projectDirectory = $ projectDirectory ;
5656 $ this ->doctrineHelper = $ doctrineHelper ;
57+
58+ if (null === $ generator ) {
59+ @trigger_error (sprintf ('Passing a "%s" instance as 4th argument is mandatory since version 1.5. ' , Generator::class), E_USER_DEPRECATED );
60+ $ this ->generator = new Generator ($ fileManager , 'App \\' );
61+ } else {
62+ $ this ->generator = $ generator ;
63+ }
5764 }
5865
5966 public static function getCommandName (): string
@@ -75,7 +82,7 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
7582 $ inputConf ->setArgumentAsNonInteractive ('name ' );
7683 }
7784
78- public function interact (InputInterface $ input , ConsoleStyle $ io , Command $ command, Generator $ generator = null )
85+ public function interact (InputInterface $ input , ConsoleStyle $ io , Command $ command )
7986 {
8087 if ($ input ->getArgument ('name ' )) {
8188 return ;
@@ -116,7 +123,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
116123 if (
117124 !$ input ->getOption ('api-resource ' ) &&
118125 class_exists (ApiResource::class) &&
119- !class_exists ($ generator ->createClassNameDetails ($ value , 'Entity \\' )->getFullName ())
126+ !class_exists ($ this -> generator ->createClassNameDetails ($ value , 'Entity \\' )->getFullName ())
120127 ) {
121128 $ description = $ command ->getDefinition ()->getOption ('api-resource ' )->getDescription ();
122129 $ question = new ConfirmationQuestion ($ description , false );
0 commit comments