Merged 3138:3139
This commit is contained in:
parent
ed383556ba
commit
9dcceb6c13
1 changed files with 204 additions and 0 deletions
|
@ -6,17 +6,221 @@ Schema files support all the normal things you would write with manual php code.
|
|||
|
||||
++ Relationships
|
||||
|
||||
When specifying relationships it is only necessary to specify the relationship on the end where the foreign key exists, although both ways are supported.
|
||||
|
||||
+++ One to One
|
||||
|
||||
<code type="yaml">
|
||||
---
|
||||
User:
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
contact_id:
|
||||
type: integer(4)
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: stirng(255)
|
||||
relations:
|
||||
Contact:
|
||||
foreignType: one
|
||||
Contact:
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
name:
|
||||
type: string(255)
|
||||
</code>
|
||||
|
||||
+++ One to Many
|
||||
|
||||
<code type="yaml">
|
||||
---
|
||||
User:
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
contact_id:
|
||||
type: integer(4)
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: stirng(255)
|
||||
Phonenumber:
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
name:
|
||||
type: string(255)
|
||||
user_id:
|
||||
type: integer(4)
|
||||
relations:
|
||||
User:
|
||||
foreignAlias: Phonenumbers
|
||||
</code>
|
||||
|
||||
+++ Many to Many
|
||||
|
||||
<code type="yaml">
|
||||
User:
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
autoincrement: true
|
||||
primary: true
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: string(255)
|
||||
attributes:
|
||||
export: all
|
||||
validate: true
|
||||
Group:
|
||||
tableName: groupp
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
autoincrement: true
|
||||
primary: true
|
||||
name:
|
||||
type: string(255)
|
||||
relations:
|
||||
Users:
|
||||
foreignAlias: Groups
|
||||
class: User
|
||||
refClass: GroupUser
|
||||
GroupUser:
|
||||
columns:
|
||||
group_id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
user_id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
</code>
|
||||
|
||||
++ Connection Binding
|
||||
|
||||
<code type="php">
|
||||
Doctrine::connection('mysql://jwage:pass@localhost/connection1', 'connection1');
|
||||
</code>
|
||||
|
||||
<code type="yaml">
|
||||
---
|
||||
User:
|
||||
connection: connection1
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
contact_id:
|
||||
type: integer(4)
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: stirng(255)
|
||||
</code>
|
||||
|
||||
++ Attributes
|
||||
|
||||
<code type="yaml">
|
||||
---
|
||||
User:
|
||||
connection: connection1
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
contact_id:
|
||||
type: integer(4)
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: stirng(255)
|
||||
attributes:
|
||||
export: none
|
||||
validate: false
|
||||
</code>
|
||||
|
||||
++ Templates
|
||||
|
||||
<code type="yaml">
|
||||
---
|
||||
User:
|
||||
connection: connection1
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
contact_id:
|
||||
type: integer(4)
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: stirng(255)
|
||||
templates:
|
||||
MyCustomTemplate
|
||||
option1: value
|
||||
option2: value
|
||||
</code>
|
||||
|
||||
++ ActAs
|
||||
|
||||
<code type="yaml">
|
||||
---
|
||||
User:
|
||||
connection: connection1
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
contact_id:
|
||||
type: integer(4)
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: stirng(255)
|
||||
actAs:
|
||||
Sluggable:
|
||||
fields: [username]
|
||||
</code>
|
||||
|
||||
++ Options
|
||||
|
||||
<code type="yaml">
|
||||
---
|
||||
User:
|
||||
connection: connection1
|
||||
columns:
|
||||
id:
|
||||
type: integer(4)
|
||||
primary: true
|
||||
autoincrement: true
|
||||
contact_id:
|
||||
type: integer(4)
|
||||
username:
|
||||
type: string(255)
|
||||
password:
|
||||
type: stirng(255)
|
||||
options:
|
||||
type: INNODB
|
||||
collate: utf8_unicode_ci
|
||||
charset: utf8
|
||||
</code>
|
||||
|
||||
++ Indexes
|
||||
|
||||
Please see chapter [doc basic-schema-mapping :index :name] for more information about indexes and their options.
|
||||
|
|
Loading…
Add table
Reference in a new issue