Doctrine 1
  1. Doctrine 1
  2. DC-740

issue with multiple connection handling

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.2.2
    • Component/s: Connection
    • Labels:
      None

      Description

      I've found an issue where doctrine will use the wrong connection for tables under certain conditions.

      In a template, I'm doing a $sf_user->hasCredential() - which is causing this to be run in sfGuardSecurityUser,

      $this->user = Doctrine::getTable('sfGuardUser')->find($id);
      

      When this execute, the calls find themselves to Doctrine_Manager::getConnectionForComponent($componentName)

      This method calls Doctrine_Core::modelsAutoload($componentName);, which fails to load the class, and returns false (no checking is done to see if it should return true).

      As this fails to include the sfGuardUser classes wher the component binding goes on, the getTAble call will use the default connection, then create the table fails to use the correct connection

      Doctrine_Core::getTable()

      return Doctrine_Manager::getInstance()->getConnectionForComponent($componentName)->getTable($componentName);
      

      the binding is done after the call to getConectionForComponent, as it's getTable that will ultimately cause the autoloader to pull in the table classes.

      1. doctrine_core.patch
        0.7 kB
        Marcel Berteler
      2. doctrine_manager.patch
        2 kB
        Marcel Berteler

        Activity

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Ian P. Christian
          • Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated: