sfPropelPostgreSqlSchemaSelectorBehaviorPlugin - 1.0.1

Schema selector on PostgreSQL database

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfPropelPostgreSqlSchemaSelectorBehaviorPlugin

Introduction

This behavior enable developer to access non "public" PostgreSQL schema.

Implementation

Edit your databases.yml, append pgsqlschema at param list :

propel:
  class:          sfPropelDatabase
  param:
    dsn:          pgsql://youruser:password@host/database
    pgsqlschema:  your_schema
other_db:
  class:          sfPropelDatabase
  param:
    dsn:          pgsql://youruser:password@host/other
    pgsqlschema:  public, schema1, schema2

Edit your apps\application_name\config\config.php. Behavior accept two coding style.

style 1:

<?php
 
...
 
sfPropelPostgreSqlSchemaSelector::apply('class');

style 2:

<?php
 
...
 
sfPropelPostgreSqlSchemaSelector::apply(array(
  'class_1', 'class_2', 'class_n'
));

class, class_1 .. class_n mean your model class.

In sfPropelPostgreSqlSchemaSelectorBehavior class definition, there are funtion with this prototype.

public static function setSchema($class, $con = null, $schema = 'public') 
{
  ...
}

You could choose PostgreSql schema at runtime by using this code :

sfPropelPgSqlSchemaSelectorBehavior::setSchema('class_name', $your_connection, $schema_name);