Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Doctrine] Relacja wiele do wielu, Mały problem z nazewnictwem i definicją
aart3k
post
Post #1





Grupa: Zarejestrowani
Postów: 72
Pomógł: 10
Dołączył: 2.02.2008
Skąd: Kraków

Ostrzeżenie: (0%)
-----


Cześć

Chciałbym zrobić relację wiele do wielu (role ACL do userów), z tym że przyjęty przeze mnie schemat nazewnictwa pól w klasach wyklucza użycie automatycznego detekcji relacji, przez co wysypuje mi się generowanie modeli z Doctrine'a.

Mój schemat yml: 
CODE
### Main user object

Profile_User:

columns:

id: { type: integer(8), primary: true, autoincrement: true }

screenName: { type: string(64) }

mail: { type: string(128) }

password: { type: string(20) }

active: { type: boolean }

indexes:

uniquescreenname: { fields: [screenName], type: unique }

uniquemail: { fields: [mail], type: unique }

attributes:

export: all

validate: true

options:

type: INNODB

collate: utf8_polish_ci

charset: utf8



Profile_AclRole:

columns:

id: { type: integer(8), primary: true, autoincrement: true }

name: { type: integer(8) }

relations:

users: { class: Profile_User, foreignAlias: roles, refClass: Profile_AclUsersRoles, local: id, foreign: roleId }

options:

type: INNODB

collate: utf8_polish_ci

charset: utf8



Profile_AclUsersRoles:

columns:

roleId: { type: integer(8), primary: true }

userId: { type: integer(8), primary: true }

relations:

Profile_User: { foreignAlias: Profile_AclUsersRoles, local: userid }

Profile_AclRole: { foreignAlias: Profile_AclUsersRoles, local: roleid }

options:

type: INNODB

collate: utf8_polish_ci

charset: utf8



Profile_AclResource:

columns:

id: { type: integer(8), primary: true, autoincrement: true }

aclRole: { type: integer(8) }

resource: { type: string(64) }

action: { type: string(32) }

allow: { type: boolean }

relations:

role: { class: Profile_AclRole, foreignAlias: resources, local: aclRole, foreign: id }

options:

type: INNODB

collate: utf8_polish_ci

charset: utf8


jak ktoś ma pomysł będę widzięczny, pewnie wystarczy dopisać pewien klucz określający w relacji w AclRole.
Taki błąd wyrzuca przy generowaniu tabelek:

CODE
SQLSTATE[HY000]: General error: 1005 Can't create table 'motomysz.#sql-a58_5e' (

errno: 121). Failing Query: ALTER TABLE profile__acl_resource ADD CONSTRAINT pro

file__acl_resource_aclrole_profile__acl_role_id FOREIGN KEY (aclrole) REFERENCES

profile__acl_role(id)




UPDATE: Wystarczy postawić bazę od nowa, wtedy zadziała.

Ten post edytował aart3k 8.06.2009, 15:59:43
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 22:38