symfony doctrine build-sql error

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. It generates a wrong schema (relations don't have on delete/on update) and after this I've tried symfony doctrine:build --sql and symfony doctrine:insert-sql

The insert-sql statement generates error (can't create table ... failing query alter table add constraint ....), so I've decided to take a look over the generated sql and I've found out some differences between the sql generated from mysql workbench (which works perfect, including relations) and the sql generated by doctrine.

I'll be short from now: I have to tables, EVENT and FORM and a 1 to n relation (each event may have multiple forms) so the correct constraint (generated with workbench) is


doctrine generated statement is:

ALTER TABLE event ADD CONSTRAINT event_id_form_event_id FOREIGN KEY (id) REFERENCES form(event_id);

It's totally reversed and I am sure here is the error. What should I do? It's also correct like this?

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

It it broken, I've wrote the schema manually and it works perfect. I didn't want to do that because it was a very large file, but I've also learned from it!

Thank you guys!

To get both visual representation and automatic code generation you can use ORM Designer so you will have everything covered by one tool.

Category:schema Views:0 Time:2010-04-10

Related post

  • "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 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

  • 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-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 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:insert-sql - "Couldn't locate driver named mysql" error 2010-04-28

    hey, I am a newbie in symfony. I am following this joobet tutorial on, I am on there day 3 Whenever I type php symfony doctrine:insert-sql, I get the following error: doctri

  • Symfony doctrine::build task cannot create table named order 2011-04-25

    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

  • doctrine:build-schema error 2011-02-04

    When I am trying to run symfony doctrine:build-schema command to fetch the schema structure to the yaml file, I got the error: SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t" LINE 6: ... t.typtype ... ^. Failing Que

  • 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

  • Symfony Doctrine Form creation error 2012-05-02

    I created the Form.i click the new link button display only title,did not work include_partial(), What is the problem? any body plz help me.other module forms works fine. This is newsuccess.php(template) <h1>New Album</h1> <?php includ

  • doctrine:build --model and --sql ok but doctrine:insert-sql is not. Do you know why? 2011-01-12

    here is my schema.yml files: issues: actAs: { Timestampable: ~ } columns: issueId: { type: integer(4), notnull: true, primary: true, autoincrement: true } issueDateForPublish: { type: timestamp, notnull: true } issueName: { type: string(255), notnull

  • Symfony: Executing custom SQL in a task 2011-04-18

    I basically want to create a custom doctrine task that truncates data in all the tables. I was trying this approach by getting the active Doctrine connection, and executing custom SQL statements that truncate the tables. After I finally got the conne

  • Altering a database in symfony (doctrine) 2010-09-16

    I'm a beginner with symfony (1.4 + Doctrine), but there is a point which scares me. It seems that whenever one wants to change a model, the only way is to change the schema for the database (config/doctrine/schema.yml) and then call symphony doctrine

  • 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

  • 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

  • "Missing class name" error on doctrine:build-schema 2010-12-02

    I have a project that connects to multiple databases. When I run doctrine:build-schema, I get an error that simply says "Missing class name." Any idea what could be going on? I suspect it has something to do with the fact that I'm connecting to multi

  • Standard idiom for adding new models to an app built on Symfony + Doctrine 2009-12-08

    What is the a standard way of adding new model to my app built on Symfony + Doctrine while maintaining all previous models and their meta-data (like relationships). What am I really looking for: A command / procedure that will be equivalent of ./scri

  • Symfony doctrine and stored procedure 2011-01-27

    I try to learn symfony by this tutorial And is very good guide. But know im want to create stored procedure. And how i can describe procedures in shema yaml files? Because when i try to ./symfony doctrine:build --all -and-load - doctrine drop my data

Copyright (C), All Rights Reserved.

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