0

I need to set environment specific table prefixes, so i found unperfect solution in inserting this in ProjectConfiguration::configureDoctrine(Doctrine_Manager $manager): (config/ProjectConfiguration.class.php)

if (sfConfig::get('app_database_table_prefix')) {
    $manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT,
    sfConfig::get('app_database_table_prefix'));
}

... and then i can set env-unique prefixes in app.yml:

prod:
  database_table_prefix: prefix__%s

BUT.. this is cool for all app, except plugins. Plugins ignores config/ProjectConfiguration.class.php.

Dont you know about alglobal solution WITHOUT changing anything in plugins directory (i need something what will influent all posible future applications plugins too)

1
  • i found temporary sollution in updating of sfPluginConfiguration::initialize() of concrete plugin by the same code like upper, but substitute $manager by Doctrine_Manager::getInstance(), but its still not final solution which should influent all future plugins without changing anything in their code. Commented Sep 8, 2010 at 9:23

1 Answer 1

2

It looks like you're using Doctrine, so it looks like you can set the prefix in your databases.yml file. The instructions are at the bottom of this page, but it looks like you can set the table name format by adding the tblname_format to the attributes in databases.yml like so:

all:
  doctrine:
    param:
      attributes:
        tblname_format: YOURPREFIX_%s
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.