Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work with handlers as service #12

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix the function that update DependencyInjection file
  • Loading branch information
WBerredo committed Nov 24, 2014
commit 5c1b219f815dd8416e5f2ffc10f3e8cb330d0cd3
19 changes: 13 additions & 6 deletions src/Voryx/RESTGeneratorBundle/Generator/DoctrineRESTGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,25 @@ public function declareService()
}

$newXML->saveXML($services);
$this->updateDIFile($fileName);
}

private function updateDIFile($fileName)
{
$toInput = PHP_EOL."\t\t\$loader2 = new Loader\\XmlFileLoader(\$container, new FileLocator(__DIR__ . '/../Resources/config'));" .PHP_EOL.
"\t\t\$loader2->load('servicesREST.xml');".PHP_EOL."\t";

$content = file_get_contents($fileName);
if (!strpos($content, "servicesREST.xml")) {
$content = str_replace("}", "", $content);
$text = file_get_contents($fileName);

$content .= "\t\t\$loader2 = new Loader\\XmlFileLoader(\$container, new FileLocator(__DIR__ . '/../Resources/config'));" . PHP_EOL .
"\t\t\$loader2->load('servicesREST.xml');" . PHP_EOL . "\t}" . PHP_EOL . "}";
if (strpos($text, "servicesREST.xml") == false) {
$position = strpos($text, "}", strpos($text, "function load("));

file_put_contents($fileName, $content);
$newContent = substr_replace($text, $toInput, $position, 0);
file_put_contents($fileName, $newContent);
}
}


/**
* Generates the functional test class only.
*
Expand Down