@@ -103,6 +103,10 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
103
103
public function interact (InputInterface $ input , ConsoleStyle $ io , Command $ command ): void
104
104
{
105
105
if ($ input ->getArgument ('name ' )) {
106
+ if (!$ this ->verifyEntityName ($ input ->getArgument ('name ' ))) {
107
+ throw new \InvalidArgumentException ('An entity can only have ASCII letters ' );
108
+ }
109
+
106
110
return ;
107
111
}
108
112
@@ -122,6 +126,11 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
122
126
$ question = $ this ->createEntityClassQuestion ($ argument ->getDescription ());
123
127
$ entityClassName = $ io ->askQuestion ($ question );
124
128
129
+ while (!$ this ->verifyEntityName ($ entityClassName )) {
130
+ $ io ->error ('An entity can only have ASCII letter") ' );
131
+ $ entityClassName = $ io ->askQuestion ($ question );
132
+ }
133
+
125
134
$ input ->setArgument ('name ' , $ entityClassName );
126
135
127
136
if (
@@ -805,6 +814,11 @@ private function askRelationType(ConsoleStyle $io, string $entityClass, string $
805
814
return $ io ->askQuestion ($ question );
806
815
}
807
816
817
+ private function verifyEntityName (string $ entityName ): bool
818
+ {
819
+ return preg_match ('/^[a-zA-Z \\\\]+$/ ' , $ entityName );
820
+ }
821
+
808
822
private function createClassManipulator (string $ path , ConsoleStyle $ io , bool $ overwrite ): ClassSourceManipulator
809
823
{
810
824
$ manipulator = new ClassSourceManipulator (
0 commit comments