Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

When you generating schema and model you do it the same way like for the sfDoctrinePlugin.
The relations, inheritances and enums are building automatically, also when you write behaviors condition
in config/sfPostgresDoctrinePlugin/behaviors.yml the behaviors are binding to the schema and the model.

The naming of the model is automatically genereted. The main format is:

[SchemaName]_[CanonicalizedTableName]_Item

In relations:

[SchemaName]_[CanonicalizedTableName]_Item / to one

[SchemaName]_[CanonicalizedTableName]_Items / to many

In relations when is more then one for the same table the format of the alias is:

[SchemaName]_[CanonicalizedTableName]_Item_For[CanonicalizedColumnName] / to one

[SchemaName]_[CanonicalizedTableName]_Items_For[CanonicalizedColumnName] / to many

When you building db you do it the same way like for the sfDoctrinePlugin.
The creation of the schemas, inheritance, relations and object and enums defined in config/sfPostgresDoctrinePlugin/types.yml files is automatical.
If in model or schemas are some views you must put them in config/sfPostgresDoctrinePlugin/views.yml file to ommit generation process for them.

Enums and objects menagement

In config/sfPostgresDoctrinePlugin/types.yml are definition of enums and objects,
which are considered in build-sql task:

example:

public.audit: #full name of object (schemaName.objectName
body: > #sql body of the object
creator text,
createtime timestamp with time zone,
updator text,
updatetime timestamp with time zone
tables: all #to which tables check if we generating db
#may be an array with full names of the tables [schemaName1.tableName1, schemaName2.tableName2]
params:
all: audit #columns name condition
#may be an array of columns
schemaName1.tableName1:
- anotheraudit
- mainaudit
schemaName2.tableName2: [audit_a, audit_b]
types.cars: #for enums all above is the same
type: enum #type attribute is a only difference
body: >
'car',
'truck',
'bus'
tables: car.infos
params:
car.infos: vehicle_type

Behaviors menagement

In plugins/sfPostgresDoctrinePlugin/config/behaviors.yml are definition of behaviors,
which are considered in building model and schema tasks:

example:

Audit: #name of the behavior
tableName: all #to which tables check if we building model and schema
#may be an array with full names of the tables
condition:
columns: audit # behavior are binding when table has this column
params:
all:
info: 'some infos for all'
car.infos:
info: 'some infos only for car.infos table
Versioning:
tableName: all
condition:
columns: [current_from, current_to] # behavior are binding when table has this two columns
params:
all:
column_from: current_from
column_to: current_to

Views menagement

Command

symfony doctrine:build-views-schema

generate schema for views in config/genereted_views.yml

For example next thing to do is copy this file to directory config/doctrine and build model

Plugin Model management

Generating model from plugin's schema.yml file make for every plugin custom package in lib/model/directory/plugins with name of the plugin, if no tableName attribute is defined in schema.yml for plugin.

Generating sql for plugin's model process make for every plugin custom schema in db with name of the plugin, if no tableName attribute is defined in schema.yml for plugin.

Custom Recor Class

BaseDoctrineRecord.class.php in lib/model/doctrine catalog give you ability to override or implemnt custom method for all object in you model.