@@ 164-186 (lines=23) @@ | ||
161 | ||
162 | $name = $this->assistant->askAndValidate( |
|
163 | 'FormPage name', |
|
164 | function ($name) use ($generator, $bundlePath) { |
|
165 | // Check reserved words |
|
166 | if ($generator->isReservedKeyword($name)) { |
|
167 | throw new \InvalidArgumentException(sprintf('"%s" is a reserved word', $name)); |
|
168 | } |
|
169 | ||
170 | // Name should end on Page |
|
171 | if (!preg_match('/Page$/', $name)) { |
|
172 | throw new \InvalidArgumentException('The page name must end with Page'); |
|
173 | } |
|
174 | ||
175 | // Name should contain more characters than Page |
|
176 | if (strlen($name) <= strlen('Page') || !preg_match('/^[a-zA-Z]+$/', $name)) { |
|
177 | throw new \InvalidArgumentException('Invalid page name'); |
|
178 | } |
|
179 | ||
180 | // Check that entity does not already exist |
|
181 | if (file_exists($bundlePath . '/Entity/Pages/' . $name . '.php')) { |
|
182 | throw new \InvalidArgumentException(sprintf('Page or entity "%s" already exists', $name)); |
|
183 | } |
|
184 | ||
185 | return $name; |
|
186 | } |
|
187 | ); |
|
188 | $this->pageName = $name; |
|
189 |
@@ 139-161 (lines=23) @@ | ||
136 | ||
137 | $name = $this->assistant->askAndValidate( |
|
138 | 'Page name', |
|
139 | function ($name) use ($generator, $bundlePath) { |
|
140 | // Check reserved words |
|
141 | if ($generator->isReservedKeyword($name)) { |
|
142 | throw new \InvalidArgumentException(sprintf('"%s" is a reserved word', $name)); |
|
143 | } |
|
144 | ||
145 | // Name should end on Page |
|
146 | if (!preg_match('/Page$/', $name)) { |
|
147 | throw new \InvalidArgumentException('The page name must end with Page'); |
|
148 | } |
|
149 | ||
150 | // Name should contain more characters than Page |
|
151 | if (strlen($name) <= strlen('Page') || !preg_match('/^[a-zA-Z]+$/', $name)) { |
|
152 | throw new \InvalidArgumentException('Invalid page name'); |
|
153 | } |
|
154 | ||
155 | // Check that entity does not already exist |
|
156 | if (file_exists($bundlePath . '/Entity/Pages/' . $name . '.php')) { |
|
157 | throw new \InvalidArgumentException(sprintf('Page or entity "%s" already exists', $name)); |
|
158 | } |
|
159 | ||
160 | return $name; |
|
161 | } |
|
162 | ); |
|
163 | $this->pageName = $name; |
|
164 |
@@ 120-142 (lines=23) @@ | ||
117 | $bundlePath = $this->bundle->getPath(); |
|
118 | $name = $this->assistant->askAndValidate( |
|
119 | 'PagePart name', |
|
120 | function ($name) use ($generator, $bundlePath) { |
|
121 | // Check reserved words |
|
122 | if ($generator->isReservedKeyword($name)) { |
|
123 | throw new \InvalidArgumentException(sprintf('"%s" is a reserved word', $name)); |
|
124 | } |
|
125 | ||
126 | // Name should end on PagePart |
|
127 | if (!preg_match('/PagePart$/', $name)) { |
|
128 | throw new \InvalidArgumentException('The pagepart name must end with PagePart'); |
|
129 | } |
|
130 | ||
131 | // Name should contain more characters than PagePart |
|
132 | if (strlen($name) <= strlen('PagePart') || !preg_match('/^[a-zA-Z]+$/', $name)) { |
|
133 | throw new \InvalidArgumentException('Invalid pagepart name'); |
|
134 | } |
|
135 | ||
136 | // Check that entity does not already exist |
|
137 | if (file_exists($bundlePath.'/Entity/PageParts/'.$name.'.php')) { |
|
138 | throw new \InvalidArgumentException(sprintf('PagePart or entity "%s" already exists', $name)); |
|
139 | } |
|
140 | ||
141 | return $name; |
|
142 | } |
|
143 | ); |
|
144 | $this->pagepartName = $name; |
|
145 |