@@ 164-188 (lines=25) @@ | ||
161 | /** |
|
162 | * Update the getPossibleChildTypes function of the parent Page classes |
|
163 | */ |
|
164 | private function updateParentPages() |
|
165 | { |
|
166 | $phpCode = " array(\n"; |
|
167 | $phpCode .= " 'name' => '" . $this->entity . "',\n"; |
|
168 | $phpCode .= " 'class'=> '" . |
|
169 | $this->bundle->getNamespace() . |
|
170 | '\\Entity\\Pages\\' . $this->entity . "'\n"; |
|
171 | $phpCode .= ' ),'; |
|
172 | ||
173 | // When there is a BehatTestPage, we should also allow the new page as sub page |
|
174 | $behatTestPage = $this->bundle->getPath() . '/Entity/Pages/BehatTestPage.php'; |
|
175 | if (file_exists($behatTestPage)) { |
|
176 | $this->parentPages[] = $behatTestPage; |
|
177 | } |
|
178 | ||
179 | foreach ($this->parentPages as $file) { |
|
180 | $data = file_get_contents($file); |
|
181 | $data = preg_replace( |
|
182 | '/(function\s*getPossibleChildTypes\s*\(\)\s*\{\s*return\s*array\s*\()/', |
|
183 | "$1\n$phpCode", |
|
184 | $data |
|
185 | ); |
|
186 | file_put_contents($file, $data); |
|
187 | } |
|
188 | } |
|
189 | } |
|
190 |
@@ 213-237 (lines=25) @@ | ||
210 | /** |
|
211 | * Update the getPossibleChildTypes function of the parent Page classes |
|
212 | */ |
|
213 | private function updateParentPages() |
|
214 | { |
|
215 | $phpCode = " array(\n"; |
|
216 | $phpCode .= " 'name' => '" . $this->entity . "',\n"; |
|
217 | $phpCode .= " 'class'=> '" . |
|
218 | $this->bundle->getNamespace() . |
|
219 | '\\Entity\\Pages\\' . $this->entity . "'\n"; |
|
220 | $phpCode .= ' ),'; |
|
221 | ||
222 | // When there is a BehatTestPage, we should also allow the new page as sub page |
|
223 | $behatTestPage = $this->bundle->getPath() . '/Entity/Pages/BehatTestPage.php'; |
|
224 | if (file_exists($behatTestPage)) { |
|
225 | $this->parentPages[] = $behatTestPage; |
|
226 | } |
|
227 | ||
228 | foreach ($this->parentPages as $file) { |
|
229 | $data = file_get_contents($file); |
|
230 | $data = preg_replace( |
|
231 | '/(function\s*getPossibleChildTypes\s*\(\)\s*\{\s*return\s*array\s*\()/', |
|
232 | "$1\n$phpCode", |
|
233 | $data |
|
234 | ); |
|
235 | file_put_contents($file, $data); |
|
236 | } |
|
237 | } |
|
238 | } |
|
239 |
@@ 488-510 (lines=23) @@ | ||
485 | /** |
|
486 | * Update the getPossibleChildTypes function of the parent Page classes |
|
487 | */ |
|
488 | public function updateParentPages() |
|
489 | { |
|
490 | $phpCode = " array(\n"; |
|
491 | $phpCode .= " 'name' => '" . $this->entity . "OverviewPage',\n"; |
|
492 | $phpCode .= " 'class'=> '" . $this->bundle->getNamespace() . '\\Entity\\Pages\\' . $this->entity . "OverviewPage'\n"; |
|
493 | $phpCode .= ' ),'; |
|
494 | ||
495 | // When there is a BehatTestPage, we should also allow the new page as sub page |
|
496 | $behatTestPage = $this->bundle->getPath() . '/Entity/Pages/BehatTestPage.php'; |
|
497 | if (file_exists($behatTestPage)) { |
|
498 | $this->parentPages[] = $behatTestPage; |
|
499 | } |
|
500 | ||
501 | foreach ($this->parentPages as $file) { |
|
502 | $data = file_get_contents($file); |
|
503 | $data = preg_replace( |
|
504 | '/(function\s*getPossibleChildTypes\s*\(\)\s*\{\s*return\s*array\s*\()/', |
|
505 | "$1\n$phpCode", |
|
506 | $data |
|
507 | ); |
|
508 | file_put_contents($file, $data); |
|
509 | } |
|
510 | } |
|
511 | } |
|
512 |