Look on Client: relations - you have Book relation here with foreign id set to book_id, but you haven't book_id columnt in your Book table... ;)
On 1 ún, 06:51, AnTiLo0p <[email protected]> wrote: > I'm trying to make the following scheme work, but I just can't do > it... I'm getting mess with all the doctrine "one to many" relations, > could you please give me any adivise?, I'm getting following error > after doing a doctrine-insert-sql: > > SQLSTATE[42000]: Syntax error or access violation: 1072 Key column > 'book_id' doesn't exist in table. Failing Query: "CREATE TABLE book > (id BIGINT AUTO_INCREMENT, client_id BIGINT, service_id BIGINT NOT > NULL, start DATE NOT NULL, comments VARCHAR(255), created_at DATETIME > NOT NULL, updated_at DATETIME NOT NULL, INDEX client_id_idx > (client_id), INDEX service_id_idx (service_id), INDEX book_id_idx > (book_id), PRIMARY KEY(id)) ENGINE = INNODB". > > This is what I'm tryng to model: > One user/admin has 1 bussines that have 1 or many branches with one or > many services > There is one calendar for each service for each bussines > And a client can do many books on any service from any bussines, > > the schema file I'm using is: > > User: > columns: > email: { type: string(255), notnull: true, unique: true, email: > true} > name: { type: string(255) } > lastname: { type: string(255) } > > Administrator: > actAs: > Timestampable: ~ > inheritance: > extends: User > type: concrete > columns: > bussines_id: { type: integer } > superadmin: { type: boolean, default: false } > type: { type: string(255) } > > Client: > actAs: > Timestampable: ~ > inheritance: > extends: User > type: concrete > columns: > pais: { type: string, country: true } > phone: { type: string } > ciudad: { type: string(255) } > estado: { type: string(255) } > direccion: { type: string(255) } > relations: > Book: { type: many, class: Book, local: id, foreign: book_id, > foreignAlias: Clients } > > Staff: > actAs: > Timestampable: ~ > inheritance: > extends: User > type: concrete > columns: > bussines_id: { type: integer } > branch_id: { type: integer } > > Category: > actAs: > Sluggable: > fields: [ name ] > columns: > name: { type: string(255) } > > Bussines: > actAs: > Sluggable: > fields: [ name ] > Searchable: > fields: [ name, direccion, pais ] > Timestampable: ~ > columns: > category_id: { type: integer } > administrator_id: { type: integer } > name: { type: string(255) } > direccion: { type: string(255) } > pais: { type: string(255), country: true } > url: { type: string(255) } > email: { type: string(255), email: true } > telefono: { type: string(255) } > relations: > Category: { local: category_id, foreign: id, foreignAlias: > Bussineses, foreignType: one } > Administrator: { local: administrator_id, foreign: id, > foreignAlias: Bussineses } > Branch: { type: many, class: Branch, local: id, foreign: > branch_id } > > Branch: > columns: > bussines_id: { type: integer } > name: { type: string(255), default: Matriz } > is_matriz: { type: boolean, default: true } > direccion: { type: string(255) } > email: { type: string(255) } > telefono: { type: string(255) } > relations: > Bussines: { local: bussines_id, foreign: id } > Service: { type: many, class: Service, foreignAlias: Branches, > local: id, foreign: service_id } > > Service: > actAs: > Timestampable: ~ > Searchable: > fields: [ name ] > columns: > branch_id: { type: integer } > name: { type: string(255), notnull: true } > costo: { type: decimal, notnull: true } > duration: { type: integer, notnull: true } > relations: > Branch: { local: branch_id, foreign: id, foreignAlias: Services } > Book: { type: many, class: Book, local: id, foreign: book_id, > foreignAlias: Services } > > Calendar: > actAs: > Timestampable: ~ > columns: > bussines_id: { type: integer, notnull: true } > service_id: { type: integer, notnull: true } > content: { type: string(255) } > relations: > Service: { type: many, local: service_id, foreign: id, > foreignAlias: Calendars } > > Book: > actAs: > Timestampable: ~ > Searchable: > fields: [ start ] > columns: > client_id: { type: integer } > service_id: { type: integer, notnull: true } > start: { type: date, notnull: true } > comments: { type: string(255) } > relations: > Client: { local: client_id, foreign: id, foreignAlias: Books } > Service: { local: service_id, foreign: id, foreignAlias: Books } -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
