![]() |
|
sfPostgresDoctrinePlugin - 1.2.26A postgres doctrine plugin. |
|
![]() |
6
users
Sign-in
to change your status |
The plugin that extends the sfDoctrinePlugin for Postgres database. |
This plugin transparently override behavior of sfDoctrinPlugin.
It gives you:
ability to have a real inheritance
schemas menagement
ability to omit tables in schema and model generation process
ability to have one to one relation in schema and models generating process
enums and objects menagement
behaviors menagement
views menagement
plugin model management
ability to use custom record class for all Doctrine_Record objects
ability to use custom table class for all Doctrine_Table objects
ability to use uppercase in names of schemas, tables and columns
| Name | Status | |
|---|---|---|
|
|
lead | lp.pw <<ta>> elezrtsm |
Copyright (c) 2010 Michał Strzelecki
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.
| Version | License | API | Released |
|---|---|---|---|
| 1.2.26stable | MIT license | 1.2.26stable | 04/03/2011 |
| 1.2.25stable | MIT license | 1.2.25stable | 15/01/2011 |
| 1.2.24stable | MIT license | 1.2.24stable | 16/12/2010 |
| 1.2.23stable | MIT license | 1.2.23stable | 15/12/2010 |
| 1.2.22stable | MIT license | 1.2.22stable | 13/12/2010 |
| 1.2.21stable | MIT license | 1.2.21stable | 13/12/2010 |
| 1.2.20stable | MIT license | 1.2.20stable | 09/12/2010 |
| 1.2.19stable | MIT license | 1.2.19stable | 03/12/2010 |
| 1.2.16stable | MIT license | 1.2.16stable | 03/12/2010 |
| 1.2.15stable | MIT license | 1.2.15stable | 03/12/2010 |
| 1.2.14stable | MIT license | 1.2.14stable | 02/12/2010 |
| 1.2.13stable | MIT license | 1.2.13stable | 01/12/2010 |
| 1.2.12stable | MIT license | 1.2.12stable | 30/11/2010 |
| 1.2.03stable | MIT license | 1.2.03stable | 29/11/2010 |
| 1.2.02stable | MIT license | 1.2.02stable | 28/11/2010 |
| 1.2.01beta | MIT license | 1.2.01beta | 27/11/2010 |
| 1.1.27stable | MIT license | 1.1.27stable | 25/11/2010 |
| 1.1.26stable | MIT license | 1.1.26stable | 25/11/2010 |
| 1.1.25stable | MIT license | 1.1.25stable | 17/11/2010 |
| 1.1.24stable | MIT license | 1.1.24stable | 01/09/2010 |
| 1.1.23stable | MIT license | 1.1.23stable | 01/09/2010 |
| 1.1.22stable | MIT license | 1.1.22stable | 01/09/2010 |
| 1.1.21stable | MIT license | 1.1.21stable | 30/08/2010 |
| 1.1.20stable | MIT license | 1.1.20stable | 18/08/2010 |
| 1.1.19stable | MIT license | 1.1.19stable | 17/08/2010 |
| 1.1.18stable | MIT license | 1.1.18stable | 17/08/2010 |
| 1.1.17stable | MIT license | 1.1.17stable | 16/08/2010 |
| 1.1.16stable | MIT license | 1.1.16stable | 16/08/2010 |
| 1.1.15stable | MIT license | 1.1.15stable | 01/08/2010 |
| 1.1.14stable | MIT license | 1.1.14stable | 30/07/2010 |
| 1.1.13stable | MIT license | 1.1.13stable | 27/07/2010 |
| 1.1.12stable | MIT license | 1.1.12stable | 27/07/2010 |
| 1.1.11stable | MIT license | 1.1.11stable | 27/07/2010 |
| 1.1.10stable | MIT license | 1.1.10stable | 27/07/2010 |
| 1.0.13stable | MIT license | 1.0.13stable | 27/07/2010 |
| 1.0.12stable | MIT license | 1.0.12stable | 21/07/2010 |
| 1.0.11stable | MIT license | 1.0.11stable | 21/07/2010 |
| 1.0.10stable | MIT license | 1.0.10stable | 21/07/2010 |
| 1.0.9stable | MIT license | 1.0.9stable | 20/07/2010 |
| 1.0.8stable | MIT license | 1.0.8stable | 20/07/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.2.26stable | MIT license | 1.2.26stable | 04/03/2011 |
| 1.2.25stable | MIT license | 1.2.25stable | 15/01/2011 |
| 1.2.24stable | MIT license | 1.2.24stable | 16/12/2010 |
| 1.2.23stable | MIT license | 1.2.23stable | 15/12/2010 |
| 1.2.22stable | MIT license | 1.2.22stable | 13/12/2010 |
| 1.2.21stable | MIT license | 1.2.21stable | 13/12/2010 |
| 1.2.20stable | MIT license | 1.2.20stable | 09/12/2010 |
| 1.2.19stable | MIT license | 1.2.19stable | 03/12/2010 |
| 1.2.16stable | MIT license | 1.2.16stable | 03/12/2010 |
| 1.2.15stable | MIT license | 1.2.15stable | 03/12/2010 |
| 1.2.14stable | MIT license | 1.2.14stable | 02/12/2010 |
| 1.2.13stable | MIT license | 1.2.13stable | 01/12/2010 |
| 1.2.12stable | MIT license | 1.2.12stable | 30/11/2010 |
| 1.2.03stable | MIT license | 1.2.03stable | 29/11/2010 |
| 1.2.02stable | MIT license | 1.2.02stable | 28/11/2010 |
| 1.2.01beta | MIT license | 1.2.01beta | 27/11/2010 |
| 1.1.27stable | MIT license | 1.1.27stable | 25/11/2010 |
| 1.1.26stable | MIT license | 1.1.26stable | 25/11/2010 |
| 1.1.25stable | MIT license | 1.1.25stable | 17/11/2010 |
| 1.1.24stable | MIT license | 1.1.24stable | 01/09/2010 |
| 1.1.23stable | MIT license | 1.1.23stable | 01/09/2010 |
| 1.1.22stable | MIT license | 1.1.22stable | 01/09/2010 |
| 1.1.21stable | MIT license | 1.1.21stable | 30/08/2010 |
| 1.1.20stable | MIT license | 1.1.20stable | 18/08/2010 |
| 1.1.19stable | MIT license | 1.1.19stable | 17/08/2010 |
| 1.1.18stable | MIT license | 1.1.18stable | 17/08/2010 |
| 1.1.17stable | MIT license | 1.1.17stable | 16/08/2010 |
| 1.1.16stable | MIT license | 1.1.16stable | 16/08/2010 |
| 1.1.15stable | MIT license | 1.1.15stable | 01/08/2010 |
| 1.1.14stable | MIT license | 1.1.14stable | 30/07/2010 |
| 1.1.13stable | MIT license | 1.1.13stable | 27/07/2010 |
| 1.1.12stable | MIT license | 1.1.12stable | 27/07/2010 |
| 1.1.11stable | MIT license | 1.1.11stable | 27/07/2010 |
| 1.1.10stable | MIT license | 1.1.10stable | 27/07/2010 |
| 1.0.13stable | MIT license | 1.0.13stable | 27/07/2010 |
| 1.0.12stable | MIT license | 1.0.12stable | 21/07/2010 |
| 1.0.11stable | MIT license | 1.0.11stable | 21/07/2010 |
| 1.0.10stable | MIT license | 1.0.10stable | 21/07/2010 |
| 1.0.9stable | MIT license | 1.0.9stable | 20/07/2010 |
| 1.0.8stable | MIT license | 1.0.8stable | 20/07/2010 |
The sfPostgresDoctrinePlugin is a symfony plugin that extends the sfDoctrinePlugin
for Postgres database.
It gives you:
ability to have a real inheritance
schemas menagement
ability to omit tables in schema and model generation process
ability to have one to one relation in schema and models generating process
enums and objects menagement
behaviors menagement
views menagement
plugin model management
ability to use custom record class for all Doctrine_Record objects
ability to use custom table class for all Doctrine_Table objects
ability to use uppercase in names of schema, tables and columns
Install the plugin (via a package)
symfony plugin:install sfPostgresDoctrinePlugin
Install the plugin (via a Subversion checkout)
svn co http//svn.symfony-project.com/plugins/sfPostgresDoctrinePlugin/trunk plugins/sfPostgresDoctrinePlugin
Publich config
symfony plugin:publish-configs
Activate the plugin in the config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration { public function setup() { $this->enablePlugins(array( 'sfDoctrinePlugin', 'sfPostgresDoctrinePlugin', '...' )); } }
When you have already model for the plugins in db and you want to generate schema from db you must omit all tables for plugins in this process. The cause of that is plugin hava custom schema in his folder, and we cannot overwrite them!!!
So you must use omit.yml file
So in section tables in omit.yml file you must have tables to ommit, for example:
tables:
- 'sfdoctrineguarplugin.*' #omit all tables in schema 'sfdoctrineguarplugin'
- 'public.sf*' #omit all tables in schema 'public' starting with 'sf'
You always must tell in tableName attribute fullname of the table, which is schemaName.tableName and set the packege attribute to schemaName.Entities
example:
Vehicle:
tableName: public.vehicles
package: Public.Entities
...
Car:
tableName: car.infos
package: Car.Entities
...
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. If you want't omit some table you must put them in config/sfPostgresDoctrinePlugin/omit.yml file.
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/omit.yml file (before it was views.yml but plugin has backward compability and also check this file) to omit generation process for them.
When you generating schema and model in onetoone.yml file you configure relations.
example:
Public_User_Item has many Public_UserData_Item and has relations Public_UserData_Items
and should have one Public_UserData_Item so:
Public_UserData_Item: Public_User_Item
or
Public_User_Item: Public_UserData_Item
in schema.yml file the only information is
inheritance:
extends: #ParentModelName#
example:
Vehicle:
tableName: public.vehicles
package: Public.Entities
...
Bikes:
tableName: public.bikes
package: Public.Entities
inheritance:
extends: Vehicle
...
Car:
tableName: car.infos
package: Car.Entities
inheritence:
extends: Vehicle
...
Truck:
tableName: public.trucks
package: Public.Entities
inheritence:
extends: Car
...
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
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
Privilege:
tableName: all # all table
exclusions: # except this collection
- 'catalogs.*'
- 'users.*'
- 'public.*'
- books.novels
condition: # without (!) and with columns
columns: ['!current_from', '!current_to', version]
params:
all:
operations: # for all permit insert and forbid update
insert: permit
update: forbidden
sales.item:
operations: # for one permit conditional update
update:
permit: internal_name #only this column can be update
'*.common*': # for this pattern forbidden unblocked insert -> (params:all)
operations:
insert: forbidden
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
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.
BaseDoctrineRecord.class.php in lib/model/doctrine catalog give you ability to override or implement custom method for all object in you model.BaseDoctrineTable.class.php in lib/model/doctrine catalog give you ability to override or implement custom method for all tables in you model.Ability to have stored procedures (with arguments) as normal model
Postgres array type implementing to special behavior (for totally automated process)
Custom type implementing to special behavior (for totally automated process)

