Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:25:05+00:00 2026-06-15T07:25:05+00:00

I am building a custom plugin, which consists of schema which I am trying

  • 0

I am building a custom plugin, which consists of schema which I am trying to keep tightly coupled with the plugin. For example, I have a plugins/userPlugin/config/doctrine/schema.yml which references a ‘store-rw-user’ connection. My goal is to force the project’s databases.yml to contain a connection for ‘store-rw-user’, this way the project will be responsible for setting up the separate user connection.

However, when I attempt to access plugin related code I keep getting: Doctrine_Manager_Exception Unknown connection: store-rw-user.

Here is the related snippet of the plugin schema file:

# plugins/userPlugin/config/doctrine/schema.yml
connection: store-rw-user

User:
  tableName: user
  actAs: [Timestampable]    

And here is the related snippet of the BaseUser.class.php (generated when doing a model build):

<?php
// lib/model/doctrine/userPlugin/base/BaseUser.class.php

// Connection Component Binding
Doctrine_Manager::getInstance()->bindComponent('User', 'store-rw-user');

....

And finally the related snippet of the project’s databases.yml file:

# config/databases.yml
all:
  store-rw-user:
    class: sfDoctrineDatabase
    param:
    ....

On the outset, everything looks configured correctly. The plugin schema.yml resulted in the base class binding the correct database connection, which exists in the project’s databases.yml file. However, I am running into the aforementioned issue. I’d like to know if there is another approach to this issue before I start trying to manipulate doctrine connection manager manually via the plugins initialize() method.

— Update —

After further investigation, it appears that sfDatabaseManager is aware of the ‘store-rw-user’ connection, however, Doctrine_Manager is not. At first I thought this was maybe due to the order in which I added plugins within the main project config file, but it only affected whether sfDatabaseManager was connection aware, but for the sake of completeness, here is the snippet of the project config file:

// config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration
{
    ....

    public function setup()
    {
        ....

        $this->enablePlugins(
            array(
                'sfDoctrinePlugin',
                'userPlugin'
            )
        );
    }
}

And just in case it matters, here is the app.yml for the userPlugin:

# plugins/userPlugin/config/app.yml
# This entry was needed so build-model was executed, the plugin schema file would be pulled in for build as well
all:
  userPlugin:
    config_dir: %SF_PLUGINS_DIR%/userPlugin/config
    recursive: true

And here is the confusing snippet of code, where I have access to ‘store-rw-user’ connection via sfDatabaseManager but not Doctrine_Manager, which is a problem because the error is being thrown from Doctrine_Manager and not sfDatabaseManager:

// plugins/userPlugin/config/userPluginConfiguration.class.php
class userPluginConfiguration extends sfPluginConfiguration
{
    public function initialize()
    {
        parent::initialize();

        var_dump(Doctrine_Manager::getInstance()->getConnections());

        $config = ProjectConfiguration::getActive();

        $manager = new sfDatabaseManager($config);

        var_dump($manager->getDatabase('store-rw-user'));

        exit;
    }
}

And the results:

array (size=0)
  empty

object(sfDoctrineDatabase)[53]
  protected '_doctrineConnection' => 
    object(Doctrine_Connection_Mysql)[55]
      protected 'driverName' => string 'Mysql' (length=5)
      protected 'dbh' => null
      protected 'tables' => 
        array (size=0)
          empty
      protected '_name' => string 'store-rw-user' (length=13)
....

Not sure what’s going on, tried looking at other plugins to see how they deal, and they don’t have any database references that I could find.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:25:07+00:00Added an answer on June 15, 2026 at 7:25 am

    After adding some debug code to select source files (Doctrine_Manager), I finally saw that in the above code snippet in the initialize() method, that by simply configuring sfDatabaseManager, doctrine then became aware of the connection. In short, my method ended up looking like this:

    class userPluginConfiguration extends sfPluginConfiguration
    {
        public function initialize()
        {
            parent::initialize();
    
            // Don't ask me why, without this the needed db connection never gets initialized and plugin craps out
            $manager = new sfDatabaseManager(ProjectConfiguration::getActive());
        }
    }
    

    And, magically, doctrine was now aware of all the connections in the project’s databases.yml file. Seems weak to me that I have to explicitly make this call, but at least I can get on with some coding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a plugin which will pull custom meta post automatically. For example if
I am building a custom jQuery plugin which allows the user to delete records
i am trying to learn building own jquery plugin . with the simple example
I'm building a custom node which outputs 3 sets of images, all of which
I'm building a custom Ubuntu kernel and have modified one of the source files.
I have a custom OS X NPAPI plugin built as universal 32 bit bundle.
I'm building an Eclipse plugin that talks to a REST interface which uses Basic
I have an android application which uses jni and I'm trying to automate build
I am building a custom image insert plugin for TinyMCE. The idea is that
I have problems displaying error_messages.html.erb partial when building custom validation. I have for instance,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.