The purpose of schema files is to allow you to manage your model definitions directly from a yaml file rather then editing php code. The yaml schema file is parsed and used to generate all your model definitions/classes.
++ Example Schema File
'tableName' and 'className' are optional. If not specified they will be set by the key of the yaml block
schema.yml
<code type="yml">
---
User:
columns:
id:
notnull: true
primary: true
autoincrement: true
type: integer
length: 4
name: id
username:
type: string
length: 255
relations:
Groups:
class: Group
refClass: UserGroup
local: user_id
foreign: group_id
type: many
UserGroup:
columns:
user_id:
type: integer
length: 4
primary: true
group_id:
type: integer
length: 4
primary: true
relations:
User:
local: user_id
foreign: id
Group:
local: group_id
foreign: id
Group:
columns:
id:
notnull: true
primary: true
autoincrement: true
type: integer
length: 4
name: id
name:
type: string
length: 255
relations:
Users:
class: User
refClass: UserGroup
local: group_id
foreign: user_id
type: many
</code>
And now we want to use some Doctrine code to parse that schema yml file and generate our models from it
<code type="php">
// This code will generate the models for schema.yml at /path/to/generate/models