Commit 9dcceb6c authored by Jonathan.Wage's avatar Jonathan.Wage

Merged 3138:3139

parent ed383556
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment