![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 172 Pomógł: 13 Dołączył: 15.11.2009 Ostrzeżenie: (0%) ![]() ![]() |
Kod #config/doctrine/schema.yml --- lm_chat_history: actAs: Timestampable: ~ columns: id: type: integer notnull: true primary: true autoincrement: true user_id: type: integer notnull: true guest_status_id: type: integer notnull: true chat_room_id: type: integer notnull: true created_date: type: timestamp notnull: true modified_date: type: timestamp notnull: true description: type: string(6000) notnull: true visited: type: boolean notnull: true default: 0 lm_chat_rooms: actAs: Timestampable: ~ columns: id: type: integer notnull: true primary: true autoincrement: true name: type: string(50) notnull: true activated: type: boolean notnull: true default: 0 created_date: type: timestamp notnull: true modified_date: type: timestamp notnull: true created_by: type: integer notnull: true lm_guest_status: actAs: Timestampable: ~ columns: id: type: integer notnull: true primary: true autoincrement: true ip: type: string(50) notnull: true browser: type: string(255) notnull: true host_name: type: string(255) notnull: true session_id: type: string(150) notnull: true last_active_time: type: integer notnull: true lm_users: actAs: Timestampable: ~ columns: id: type: integer notnull: true primary: true autoincrement: true name: type: string(25) notnull: true passwd: type: string(50) notnull: true email: type: string(150) notnull: true created_from_ip: type: string(50) notnull: true created_date: type: timestamp notnull: true modified_date: type: timestamp notnull: true chmod: type: integer notnull: true lm_users_groups: actAs: Timestampable: ~ columns: id: type: integer notnull: true primary: true autoincrement: true name: type: string(25) notnull: true activated: type: boolean notnull: true default: 1 block_guest: type: boolean notnull: true default: 0 block_users: type: boolean notnull: true default: 0 create_user: type: boolean notnull: true default: 0 remove_user: type: boolean notnull: true default: 0 preview_chats: type: boolean notnull: true default: 0 read_history: type: boolean notnull: true default: 0 send_messages: type: boolean notnull: true default: 0 kick_guest: type: boolean notnull: true default: 0 kick_user: type: boolean notnull: true default: 0 send_mail_to_user: type: boolean notnull: true default: 0 lm_users_status: actAs: Timestampable: ~ columns: id: type: integer notnull: true primary: true autoincrement: true user_id: type: integer notnull: true ip: type: string(50) notnull: true browser: type: string(255) notnull: true host_name: type: string(255) notnull: true session_id: type: string(150) notnull: true last_active_time: type: integer notnull: true lm_users_to_room: actAs: Timestampable: ~ columns: id: type: integer notnull: true primary: true autoincrement: true user_id: type: integer notnull: true chat_id: type: integer notnull: true activated: type: boolean notnull: true default: 0 created_date: type: timestamp notnull: true modified_date: type: timestamp notnull: true Widziałem w tutorialu jobeet, że z poziomu schema.yml można tworzyć relacje, jednak nie za bardzo wiem jak to zrobić. Chciałbym, aby np. lm_users_to_room.user_id było powiązane z lm_users.id i nie wiem jak to dopisać do schema.yml. W ogóle nie wiem czy dobrze rozumiem idee relacji, według mnie kiedy usunę użytkownika baza sprawdzi powiązania z id użytkownika i usunie wszystkie wpisy lm_users_to_room.user_id o podanym user_id. Jeżeli jestem w błędzie proszę mnie z niego wyprowadzić |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 91 Pomógł: 13 Dołączył: 23.08.2008 Ostrzeżenie: (0%) ![]() ![]() |
Skoro czytales dokumentacje to nie rozumiem Twojego problemu, tam jest dokladnie wszystko opisane:
http://www.symfony-project.org/jobeet/1_4/...r_03_the_schema http://www.doctrine-project.org/projects/o...schema-files/en |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 172 Pomógł: 13 Dołączył: 15.11.2009 Ostrzeżenie: (0%) ![]() ![]() |
Kod User: columns: username: type: string(255) password: type: string(255) contact_id: type: integer relations: Contact: class: Contact local: contact_id foreign: id foreignAlias: User foreignType: one type: one Contact: columns: first_name: type: string(255) last_name: type: string(255) phone: type: string(255) email: type: string(255) address: type: string(255) relations: User: class: User local: id foreign: contact_id foreignAlias: Contact foreignType: one type: one Źle sprecyzowałem moje pytanie. Chodzi o to, że w tym przykładzie relacja User -> Contact posiada linijkę: foreign: id, ale w kolumnie Contact nie widzę tabeli id. Czy jeżeli u mnie jest ona wpisana to przy tworzeniu relacji usunąć ją, czy też może zostać? Durgi problem, który zauważyłem to primary: true, sprawdziłem w phpmyadmin i żadna kolumna nie jest ustawiona na PK. |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 91 Pomógł: 13 Dołączył: 23.08.2008 Ostrzeżenie: (0%) ![]() ![]() |
Kolumna ID jest generowana automatycznie i z automatu jest ona PK
|
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 20.06.2025 - 03:23 |