Symfony doctrine::build task cannot create table named order

I have a database with a table named order. When i run php symfony doctrine:build --all, i got the folowing error:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (id BIGINT AUTO_INCREMENT, status VARCHAR(255), colissimonumber VARCHAR(25' at line 1. Failing Query: "CREATE TABLE order (id BIGINT AUTO_INCREMENT, status VARCHAR(255), colissimonumber VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = MyISAM".

The problem is clearly that order has no backquotes arount it (if i run manually the query in phpmyadmin with backquotes, it works)

How do i tell doctrine to add backquotes around table and field names? Any workaround exept renaming my table ?

I run symfony 1.4.9 with doctrine 1.2

-------------Problems Reply------------

You can turn on Doctrine_Core::ATTR_QUOTE_IDENTIFIER in your doctrine configuration mthod on projectConfiguration which will quote tables and col names but its not recommended:

Just because you CAN use delimited identifiers, it doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve. Anyway, it may be necessary when you have a reserved word as a field name (in this case, we suggest you to change it, if you can).

You probably want your model to be named Order, but this doesn't mean that the corresponding RDBMS table must be named the same.

tableName: project_order
columns: ...

Category:mysql Views:2 Time:2011-04-25

Related post

  • How to make 'symfony doctrine:build-sql' task generate 'DROP' statments? 2010-09-02

    Is there a way to make symfony doctrine:build-sql task generate DROP statments before CREATE TABLE ones as it symfony propel:build-sql does ? ? --------------Solutions------------- There is no such possibility, but you can run the doctrine:drop-db ta

  • "The task 'generate-sql' has not been registered", when executing php symfony doctrine:build --sql 2011-11-24

    I tried adding new entities to my project (Symfony 1.4) and I got the The task 'generate-sql' has not been registered error when executing php symfony doctrine:build --sql. The command php symfony doctrine:build --model executed without errors and th

  • how to resolve symfony doctrine:build-schema error (Unknown relation alias table_name) 2009-10-26

    how to resolve this symfony error : C:\inetpub\wwwroot\project\trunk\preprod\signup>php symfony doctrine:build-schema --trace >> doctrine generating yaml schema from database [sfException] Unknown relation alias table_name Exception trace: a

  • symfony doctrine build-sql error 2010-04-10

    I have some big problems with symfony and doctrine at the beginning of a new project. I have created database diagram with mysql workbench, inserted the sql into phpmyadmin and then I've tried symfony doctrine:build-schema to generate the YAML schema

  • Extending doctrine:build --db to create a DB View 2011-03-08

    I'm working on a Symfony 1.4 project with Doctrine 1.x, and functionality that merits using a Doctrie_View (as an interface for native MySQL Views). As I understand it, the View (as in DB View as opposed to the View in MVC) has to be created wth Doct

  • symfony doctrine:build --all 2011-08-29

    I have started to learn symfony and I am a little bit confused. In 'practical symfony' they explain symfony doctrine:build --model, symfony doctrine:build --sql and symfony doctrine:insert-sql but then they mention symfony doctrine:build -all without

  • Symfony doctrine:build-model errors 2010-11-07

    I have written my yaml schema for the database for my Symfony+doctrine application, and I'm trying to get it to make the models and such, but it errors on doctrine:build-model $> ./symfony doctrine:build-model >> doctrine generating model cl

  • symfony doctrine:build --all --and-load WITHOUT LOSING RECORDS IN DATABASE 2011-02-07

    I am new to Symfony+Doctrine, but fairly experienced with web application development in general (mostly using Zend Framework). I have started a new project using Symfony, and I'm loving it. I've got a handful of fixtures in my /data/fixtures/ folder

  • Doctrine 1.2 not creating tables from models in Zend Framework 2011-08-21

    I'm trying to create tables from models by using: Doctrine::createTablesFromModels(APPLICATION_PATH . '/models'); Unlike generating the models from a Yaml file, which worked just fine, this does nothing at all. No errors, no warnings, nothing. The ta

  • Issues with adding FK relations via Doctrine Build Task 2010-06-21

    I've double-checked my schema, and its correct... infact doctrine also built it once.. and now its troubling me with some FK relations... I have checked for the data-types as well. All are int(4) or int(2) 2 Qs here: 1. is there an upper limit to the

  • Symfony/Doctrine: How to iterate through table fields for hydration? 2011-02-09

    After making a SQL query to Table Post I wish to hydrate the $result array to a Doctrine object. Right now in order to do this I use a set command for each field, as below: $post = new post(); $post->setCategory($result['category']); $post->set

  • doctrine:build-schema ignoring unique key 2011-02-22

    i am using the symfony command to generate my schema.yml file from my mysql 5.1 database by running: symfony doctrine:build-schema My table: CREATE TABLE `identity` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `username` VARCHAR(64) DEFAULT NULL,

  • Unrecognized table getting created when Doctrine builds the database 2011-01-28

    I have the following schema.yml Proposition: actAs: { Timestampable: ~ } columns: name: { type: string(255), notnull: true } slug: { type: string(255), notnull: true, unique: true } proposition_type_id: { type: integer, notnull: true } icon: { type:

  • symfony migration create table and insert record 2012-02-05

    I want to create a new table and then insert a specific record in a symfony 1.4 project. I can do the data insert manually, but I would like to make use of the migration infrastructure so that when different existing instances are upgraded this row w

  • doctrine:build-schema ignoring table columns 2010-11-18

    I have a table called heading whose SHOW CREATE TABLE looks like this: CREATE TABLE `heading` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `referenced_table_name` varchar(255) NOT NULL, `column_name` varchar(255) NOT NULL, `label` varchar(255) NOT NULL

  • symfony 1.4.8+ doctrine --> doctrine:build-schema fatal error opening required /tmp/tmp_doctrine/User.php 2010-10-16

    I'm trying out symfony so i started installing it on a remote mashine thru ssh (normal user, no root access) when getting to the part where i want to generate the db-schema out of a existing mysql database with doctrine by issuing the following comma

  • How does doctrine:build-schema create config/doctrine/schema.yml? 2010-11-19

    I'm having a really tough problem and, in an effort to solve it, I want to find the code that's generating config/doctrine/schema.yml. I'm having a hard time tracking it down. Would anyone happen to know where it is? --------------Solutions----------

  • Expected path to Sluggable builder in Symfony/Doctrine 2010-12-02

    The default string normalization (provided by the Doctrine_Inflector::urlize() "sluggifier") isn't suitable for my project, so I need to utilize my own algorithm. I set my schema up as follows: MyObject: actAs: Sluggable: fields: [name] builder: arra

  • Symfony+Doctrine migrations problems 2011-05-31

    I've got a strange problem with Symfony (with sfDoctrineGuardPlugin installed) and Doctrine migrations. What I've done till now: I've dropped database and created new one withou tables I've cleaned all model files I've cleared cache run symfony task

Copyright (C), All Rights Reserved.

processed in 0.079 (s). 11 q(s)