adobe photoshop 60 download

Adobe Premiere Pro CS5 discount free adobe dream weaver 8 download free download adobe distiller cheapest adobe photoshop free download full version where does adobe save download video files

adobe bridge download

Adobe Creative Suite 4 for Mac buy cheap download adobe photoshop elements 5 adobe download free premiere pro buy cheap adobe acrobat 8 download purchase adobe photoshop cs3 extended full download

free adobe download manager

buy cheap Adobe cs5 Design Premium for Mac adobe acrobat reader 6 0 1 free download adobe flashplayer download softpedia discount download adobe after effects download adobe after effects

free download adobe illustrator 9

cheapest Adobe cs5 for Mac adobe cs2 download free crack key generator how to download adobe flash movies cheapest adobe acrobat reader free download adobe 8 free download

free adobe download

Autodesk AutoCAD cheapest adobe download free premiere adobe distiller free download discount download adobe flashplayer free adobe download manager download

adobe audition 1 5 download

cheap AutoCAD Architecture adobe acrobat 8 free download adobe creative suite 2 download cheapest download adobe premiere pro cs3 download adobe reader cd

adobe encore menu download

cheapest Adobe Captivate CS5.5 download adobe ebook reader adobe photoshop elements 3 for mac download cheap download adobe photoshop 7 download adobe flash player

download adobe reader latest version

discount Creative Suite 5.5 download adobe photoshop cs2 adobe photoshop 8 free download full version discount download free adobe standard adobe flas player 9 download

download adobe photoshop mac free

Autodesk AutoCAD discount free adobe 8 download free download of adobe pagemaker buy cheap adobe dream weaver 8 download download adobe scanner

adobe reader download for mac

discount AutoCAD 2010 free adobe download free download of adobe reader buy cheap free download adobe photodeluxe home edition adobe flash player 8 download

adobe lightroom download

AutoCAD LT 2012 buy cheap adobe golive cs2 download freeware adobe acrobat download cheap adobe flash activex download download adobe flashplayer

adobe flash 9 download

adobe acrobat x buy cheap adobe free download software download adobe photoshop cs2 cheap download adobe audition 3 free adobe premiere download

adobe flash offline download

adobe creative suite 5 discount download adobe acrobat reader 8 adobe 9 download discount free adobe photoshop elements 6 download download adobe reader pdf free

search adobe reader 7 0 download

cheap adobe cs5 adobe acrobat writer free download adobe fine reader free download cheap adobe player download center adobe professional download

download adobe flashplayer free

Adobe cs5 Design Premium cheapest where free download adobe acrobat free download of adobe reader buy cheap adobe flash 7 download download adobe reader8

free adobe acrobat writer download

Adobe eLearning Suite cheap download adobe active x download adobe acrobat 7 updates discount download adobe flash 9 for h264 free adobe pdf maker download

adobe photo plus 6 download

discount Adobe eLearning Suite 2 download adobe photoshop cs2 adobe illustrator full crack download cheapest adobe photoshop download site adobe acrobat raeder v7 download

adobe flash player download for windows vista

discount Adobe Flash Catalyst CS5 adobe photo editor download adobe reader 6 free download discount download adobe flashplayer free free download adobe illustrator 9

adobe shockwave player download

discount Adobe Indesign CS5 free adobe dream weaver 8 download adobe photo free download cheapest adobe flash player downloader free download hunter grabber free adobe profesional 8 download

adobe type manager download free

discount Adobe Photoshop CS5 download adobe acrobat reader free old adobe software download discount download adobe flash player stand alone adobe acrobat update download

Symfony | Doctrine | Error | SQLSTATE[HY000]: General error: 1005 Can’t create table XXX.#sql-818 _1′ (errno: 121). Failing Query:” ALTER TABLE xxx ADD CONSTRAINT …. FOREIGN KEY (xyz) REFERENCES XXX(id) ON DELETE CASCADE”

Symfony is a web application framework written in PHP which follows the model-view-controller  (MVC) paradigm . A symfony developer may use Object-Relational Mapping (ORM) – Propel or Doctrine . The earlier version of symfony supported propel and i was using it . But in updated versions symfony supported Doctrine and was forced to update my skills in ORM .

Configuring symfony is pretty simple and model and sql was generated successfully . But on executing the command line argument to insert sql .


symfony doctrine:insert-sql

i got an error :

SQLSTATE[HY000]: General error: 1005 Can’t create table XXX.#sql-818_1′ (errno: 121). Failing Query:” ALTER TABLE xxx ADD CONSTRAINT …. FOREIGN KEY (XYZ) REFERENCES XXX(id) ON DELETE CASCADE”

The error got on my nerves and couldn’t figure out what was it all about . But i was sure its something related to foreign key and after some research i got a fix for it and i am sharing it with you .

There is an issue with your ID columns. Normally this has to do with the foreign key and primary keys having different length constraints. Your fix:

Make sure that the length constraints match. If you aren’t specifying a length, you can simply remove the ID field from your schema.yml, and let Doctrine create it for you, or if you want to be explicit, you can set a length and make sure it is matched in the related foreign key field.

MetroUsers:
actAs: { Timestampable: ~ }
columns:
username: { type: string(255), notnull: true, unique: true }
password:        { type: string(255), notnull: true }
hash:        { type: string(255), notnull: true }

MetroUserDetails:
actAs: { Timestampable: ~ }
columns:
metro_user_id:       { type: integer, notnull: true }
ref_from:     { type: string(255), notnull: true, unique: true }
mobilenumber:     { type: string(255), notnull: true }
is_mobile_valid:      { type: boolean, notnull: true, default: 0 }
email_id:     { type: string(255), notnull: true }
relations:
MetroUsers: { onDelete: CASCADE, local: metro_user_id, foreign: id, foreignAlias: MetroUserDetail }

Here id is generated automatically for MetroUsers and make sure that metro_user_id is of type integer .

About the Author: a holistic web developer , movie buff and technical blogger from queen of arabian sea.

RSSComments (8)

Leave a Reply | Trackback URL

  1. Bruno says:

    Oh, thank you very much mate, I had the same problem with Code Igniter and Doctrine…! What a headache!! :)

  2. anoopsachari says:

    @Bruno did my post help you to solve the issue ?

  3. Tuan says:

    I have same problem. like this:
    Article:
    tableName: article
    columns:
    id: { type: integer(4), primary: true, autoincrement: true }
    title: { type: string(255), notnull: true, }
    content: { type: clob }
    author_id: { type: integer(4), notnull: true }
    category_id: { type: integer(4) }
    relations:
    Author:
    foreignAlias: Articles
    onDelete: CASCADE
    local: author_id
    foreign: id
    Category:
    foreignType: one
    local: category_id
    foreign: id

    Author:
    tableName: author
    columns:
    name: { type: string(20) }

    Category:
    tableName: category
    columns:
    name: { type: string(255), notnull: true }

    and it don’t work. I must change all table’s primary to int. some thing like :

    Article:
    tableName: article
    columns:
    id: { type: integer, primary: true, autoincrement: true }
    title: { type: string(255), notnull: true, }
    content: { type: clob }
    author_id: { type: integer, notnull: true }
    category_id: { type: integer }
    relations:
    Author:
    foreignAlias: Articles
    onDelete: CASCADE
    local: author_id
    foreign: id
    Category:
    foreignType: one
    local: category_id
    foreign: id

    Author:
    tableName: author
    columns:
    name: { type: string(20) }

    Category:
    tableName: category
    columns:
    name: { type: string(255), notnull: true }
    and it’s work.
    Thaks for share

  4. Carkod says:

    Hi. Just wanted to say that you’ve got a database error in your title

  5. Marcos says:

    thank you for saving my time!

  6. Dave says:

    Legend, solved my problem.. many thanks.

  7. Gaurav says:

    Thank a ton man… Your solution saved me… This problem drove me nuts and your solution worked like a charm.

    Thanks :)

  8. lesta says:

    Thank you! You saved my day.

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes