How to save doctrine database schema in a Symfony controller? -


i'm using symfony 2.3 , doctrine 2 , need user save schema of doctrine database file (*.sql). need action method , send file user

just started, should work in concept. didn't run it, assume might need little tweaks side.

<?php use symfony\component\console\input\arrayinput; use symfony\component\console\output\nulloutput; use doctrine\bundle\doctrinebundle\command\proxy\createschemadoctrinecommand;  // controller  public function myaction() {     $command = new createschemadoctrinecommand();     $command->setcontainer($this->container);     $input = new arrayinput(array('--dump-sql' => true));     $output = new nulloutput();     $schema = $command->run($input, $output); //this schema      // write file if want     file_put_contents('path/to/schema.sql', $schema); } 

references:


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -