Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

In my symfony2 application there is a need to create a table on the basis of user selection. if user selects yes then a new table will be create into database.

I am trying to create table query into symfony2 controller but getting error message

Error: Expected SELECT, UPDATE or DELETE, got 'CREATE' 

Is it any way to run create table query into controller.

share|improve this question
    
it's a very bad practice why you wanna do that in the controller you can just run this command : php app/console generate:doctrine:entity – elkorchi anas yesterday
    
@elkorchianas , I just update my question. – Vipin Sharma yesterday
up vote 0 down vote accepted

I know that it's BAD practice, but it just a single working way that i know.

$em = $this->getDoctrine()->getManager();
$em->getConnection()->exec('create table tmp (id int)');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.