Uploaded image for project: 'Doctrine 1'
  1. Doctrine 1
  2. DC-740

issue with multiple connection handling

    Details

    • Type: Bug
    • Status: Open
    • Priority: 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

        pookey Ian P. Christian created issue -
        jwage Jonathan H. Wage made changes -
        Field Original Value New Value
        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.
        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,

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

        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()
        {code}
        return Doctrine_Manager::getInstance()->getConnectionForComponent($componentName)->getTable($componentName);
        {code}

        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.
        pookey Ian P. Christian made changes -
        Affects Version/s 1.2.2 [ 10047 ]
        Component/s Connection [ 10021 ]
        pluk77 Marcel Berteler made changes -
        Attachment doctrine_core.patch [ 10689 ]
        pluk77 Marcel Berteler made changes -
        Attachment doctrine_manager.patch [ 10814 ]

          People

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

            Dates

            • Created:
              Updated: