This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Jobeet tutorial Day13 - Error with php symfony doctrine:build --all --and-load

Discussion around this tutorial for symfony 1.2-1.4

Jobeet tutorial Day13 - Error with php symfony doctrine:build --all --and-load

by Winnie » Mon Mar 15, 2010 6:45 pm

Hello,

On the day 13 of jobeet tuto, after installing sfdoctrineguardplugin, when i use php symfony doctrine:build --all --and-load i got this 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 'all (id BIGINT AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE = INNODB' at line 1. Failing Query: "CREATE TABLE all (id BIGINT AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE = INNODB". Failing Query: CREATE TABLE all (id BIGINT AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE = INNODB



I think it is due to the creation on a table name all.... this my data/sql/schema.sql file

------


CREATE TABLE jobeet_affiliate (id BIGINT AUTO_INCREMENT, url VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, token VARCHAR(255) NOT NULL, is_active TINYINT DEFAULT '0' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE jobeet_category (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE jobeet_category_affiliate (category_id BIGINT, affiliate_id BIGINT, PRIMARY KEY(category_id, affiliate_id)) ENGINE = INNODB;
CREATE TABLE jobeet_job (id BIGINT AUTO_INCREMENT, category_id BIGINT NOT NULL, type VARCHAR(255), company VARCHAR(255) NOT NULL, logo VARCHAR(255), url VARCHAR(255), position VARCHAR(255) NOT NULL, location VARCHAR(255) NOT NULL, description TEXT NOT NULL, how_to_apply TEXT NOT NULL, token VARCHAR(255) NOT NULL UNIQUE, is_public TINYINT(1) DEFAULT '1' NOT NULL, is_activated TINYINT(1) DEFAULT '0' NOT NULL, email VARCHAR(255) NOT NULL, expires_at DATETIME NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX category_id_idx (category_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_group (id INT AUTO_INCREMENT, name VARCHAR(255), description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_group_permission (group_id INT, permission_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(group_id, permission_id)) ENGINE = INNODB;
CREATE TABLE sf_guard_permission (id INT AUTO_INCREMENT, name VARCHAR(255), description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_remember_key (id INT AUTO_INCREMENT, user_id INT, remember_key VARCHAR(32), ip_address VARCHAR(50), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id, ip_address)) ENGINE = INNODB;
CREATE TABLE sf_guard_user (id INT AUTO_INCREMENT, username VARCHAR(128) NOT NULL, algorithm VARCHAR(128) DEFAULT 'sha1' NOT NULL, salt VARCHAR(128), password VARCHAR(128), is_active TINYINT DEFAULT '1', is_super_admin TINYINT DEFAULT '0', last_login DATETIME, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_user_group (user_id INT, group_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, group_id)) ENGINE = INNODB;
CREATE TABLE sf_guard_user_permission (user_id INT, permission_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, permission_id)) ENGINE = INNODB;
CREATE TABLE all (id BIGINT AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE = INNODB;
ALTER TABLE jobeet_category_affiliate ADD CONSTRAINT jobeet_category_affiliate_category_id_jobeet_category_id FOREIGN KEY (category_id) REFERENCES jobeet_category(id) ON DELETE CASCADE;
ALTER TABLE jobeet_category_affiliate ADD CONSTRAINT jobeet_category_affiliate_affiliate_id_jobeet_affiliate_id FOREIGN KEY (affiliate_id) REFERENCES jobeet_affiliate(id) ON DELETE CASCADE;
ALTER TABLE jobeet_job ADD CONSTRAINT jobeet_job_category_id_jobeet_category_id FOREIGN KEY (category_id) REFERENCES jobeet_category(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_permission_id_sf_guard_permission_ id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_remember_key ADD CONSTRAINT sf_guard_remember_key_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_permission_id_sf_guard_permission_i d FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;


thanks for the help
Winnie
Junior Member
 
Posts: 13
Joined: Wed Mar 10, 2010 3:56 pm
Location: Marseille

Re: Jobeet tutorial Day13 - Error with php symfony doctrine:build --all --and-load

by halfer » Tue Mar 16, 2010 3:09 pm

I think there's a problem in your schema. Post it here, in [code] tags, and make sure there's no tabs in your file.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: Jobeet tutorial Day13 - Error with php symfony doctrine:

by sancai » Tue Aug 09, 2011 12:54 pm

Same issue here.
Using symfony 1.4.

This started happenning when i added the following lines to the beginning of schema.yml

Code: Select all
all:
  options:
    type: MyISAM
    collate: utf8_unicode_ci
    charset: utf8



I removed the above lines, but the issue still persists.
Ever since i cannot get my model built.

Copying my schema file:
Code: Select all
EfChartsTemporaryStore:
  tableName: ef_charts_temp
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    area_type:
      type: string()
    x_id:
      type: string()
    y_id:
      type: string()
    w_id:
      type: string()
      notnull: false
    g_id:
      type: string()
      notnull: false
    created:
      type: timestamp(25)
EfData:
  tableName: ef_data
  columns:
    id:
      type: integer(8)
      autoincrement: true
      primary: true
    indicator_id:
      type: integer(4)
      notnull: true
    area_id:
      type: integer(4)
      notnull: true
    date_type:
      type: integer(4)
      notnull: true
    date:
      type: date
      notnull: true
    weight:
      type: float(18)
      notnull: false
      default: 1
    value:
      type: float(18)
      default: null
    is_aggregated:
      type: integer(1)
      default: 0
      notnull: true
  relations:
    EfArea: { local: area_id, foreign: id, foreignAlias: RelatedData }             
    EfIndicator: { local: indicator_id, foreign: id, foreignAlias: RelatedData }
     
EfParentChildArea:
  tableName: ef_parent_child_areas
  columns:
    id:
      type: integer(8)
      autoincrement: true
      primary: true
    parent_area_id:
      type: integer(8)
    child_area_id:
      type: integer(8)
  relations:
    EfArea:
      local: parent_area_id
      foreign: id
    EfArea:
      local: child_area_id
      foreign: id
     

EfArea:
  tableName: ef_areas
  columns:
    id:
      type: integer(8)
      autoincrement: true
      primary: true
    area_type_id:
      type: integer(4)
      notnull: true
    old_area_id:
      type: integer(4)
      notnull: false
    long_name:
      type: string(100)
      notnull: true
    name:
      type: string(30)
      notnull: false
  relations:
    ParentAreas:
      refClass: EfParentChildArea  #ez lesz a result
      class: EfArea
      local: parent_area_id
      foreign: child_area_id
      type: many
    EfAreaType:
      local: area_type_id
      foreign: id
     
     
EfAreaType:
  tableName: ef_area_types
  columns:
    id:
      type: integer(4)
      autoincrement: true
      primary: true
    name:
      type: string(30)
      notnull: true
    long_name:
      type: string(100)
      default: ''
      notnull: true
    long_name_en:
      type: string(100)
      default: ''
      notnull: false
  relations:
    EfArea:
      local: id
      foreign: area_type_id
     
EfIndicator:
  tableName: ef_indicators
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    group_id:
      type: integer(4)
    name:
      type: string(50)
      default: ''
    unit:
      type: string(40)
    label:
      type: string(255)
      default: ''
    label_en:
      type: string(255)
    info:
      type: string()
    info_en:
      type: string()
    visible:
      type: integer(1)
    indicator_type:
      type: integer(4)
    ordering:
      type: integer(4)
EfIndicatorType:
  tableName: ef_indicator_types
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    name:
      type: string(100)
    aggregating_function:
      type: string(100)
EfIndicatorGroup:
  tableName: ef_indicator_groups
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    parent_id:
      type: integer(4)
      default: '0'
    group_name:
      type: string(100)
      default: ''
    group_name_en:
      type: string(100)
    ordering:
      type: integer(4)
      default: '0'
EfUser:
  tableName: ef_user
  columns:
    ef_user_id:
      type: integer(8)
      primary: true
      autoincrement: true
    ef_user_login_name:
      type: string(50)
      default: ''
    ef_user_login_pwd:
      type: string(32)
      default: ''
    ef_user_sex:
      type: integer(4)
      default: '0'
    ef_user_email:
      type: string(255)
      default: ''
    ef_user_year:
      type: integer(4)
      default: '0'
    ef_user_country:
      type: integer(4)
      default: '0'
    ef_user_county:
      type: integer(1)
      default: '0'
    ef_user_vegzettseg:
      type: integer(1)
      default: '0'
    ef_user_statusz:
      type: integer(1)
      default: '0'
    ef_user_mp_helyzet:
      type: integer(1)
      default: '0'
    ef_user_mh_tipus:
      type: integer(1)
      default: '0'
    ef_user_mh_statusz:
      type: integer(1)
      default: '0'
    ef_user_settings:
      type: string(255)
    ef_user_admin:
      type: integer(1)
      default: '0'
    ef_user_hirlevel:
      type: integer(1)
      default: '-1'
    ef_user_rdt:
      type: timestamp(25)
      default: '0000-00-00 00:00:00'
sancai
Junior Member
 
Posts: 2
Joined: Tue Aug 09, 2011 12:50 pm

Re: Jobeet tutorial Day13 - Error with php symfony doctrine:

by sancai » Tue Aug 09, 2011 1:10 pm

OKay, problem solved. Posting the resolution if someone runs into the same.

The trick was to delete everything from the cache dir and from lib/model/doctrine.

"symfony cc" command is not an option, tried that previously and it didn't work.
sancai
Junior Member
 
Posts: 2
Joined: Tue Aug 09, 2011 12:50 pm