Guest User

Untitled

a guest
Aug 15th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. /**
  2. * @Route("/testJson")
  3. */
  4. public function testJsonAction() {
  5. $app = new SymfonyBundleFrameworkBundleConsoleApplication($this->get("kernel"));
  6. $app->setAutoExit(false);
  7.  
  8. $opt = array("command" =>
  9. "doctrine:generate:entity",
  10. "--entity" => "GuervylEditorBundle:TestOnline",
  11. "--fields" => "kl:string");
  12.  
  13. $input = new SymfonyComponentConsoleInputArrayInput($opt);
  14.  
  15. $out = new SymfonyComponentConsoleOutputBufferedOutput();
  16.  
  17. $app->run($input, $out);
  18.  
  19. $out->fetch();
  20.  
  21. return new JsonResponse(json_encode(["a" => "b", "c" => "d"]));
  22. }
  23.  
  24. public function callCommand($cmd, $opt, &$mykernel = null) {
  25. if ($mykernel == NULL) {
  26. $mykernel = new myKernel("dev", false, __DIR__ . "/../Resources/template_2.8/app");
  27. }
  28.  
  29. $app = new SymfonyBundleFrameworkBundleConsoleApplication($mykernel);
  30. $app->setAutoExit(false);
  31.  
  32. $opt = array("command" => $cmd) + $opt;
  33.  
  34. $input = new SymfonyComponentConsoleInputArrayInput($opt);
  35.  
  36. $out = new SymfonyComponentConsoleOutputBufferedOutput();
  37.  
  38. $app->run($input, $out);
  39. }
  40.  
  41. Entity generation
  42.  
  43.  
  44. created ./src/Guervyl/EditorBundle/Entity/TestCase.php
  45. > Generating entity class src/Guervyl/EditorBundle/Entity/TestCase.php: OK!
  46. > Generating repository class src/Guervyl/EditorBundle/Repository/TestCaseRepository.php: OK!
  47.  
  48.  
  49. Everything is OK! Now get to work :).
Add Comment
Please, Sign In to add comment