Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connection binding to component for all autoloaded models #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alquerci
Copy link

@alquerci alquerci commented Sep 16, 2018

Patch for more than one master connection.

Modern and symfony1 applications do not use Doctrine_Core::loadModels() even conservative or aggressive mode.

For such setup models that are bound to a specific connection are attached to the current connection instead of the bound one.

After some deeper investigations for the query factory the connection is set on the flow (_passedConn === false):

  • on create set the current connection
  • call preQuery() (usage like on sfDoctrineMasterSlavePlugin get the current connection)
  • on build SQL query (just before execution) it sets the query connection for each components (I do not see any check when at least two components use different connection)

Tests

Add test - https://travis-ci.org/alquerci/doctrine1/builds/429283415
Apply fix - https://travis-ci.org/alquerci/doctrine1/builds/429251947

Patch for more than one master connection.

Modern and symfony1 applications do not use `Doctrine_Core::loadModels()` even conservative or aggressive mode.

For such setup models that are bound to a specific connection are attached to the current connection instead of the bound one.

After some deeper investigations for the query factory the connection is set on the flow (`_passedConn === false`):
* on create set the current connection
* call `preQuery()` (usage like on `sfDoctrineMasterSlavePlugin` get the current connection)
* on build SQL query (just before execution) it sets the query connection for each components (I do not see any check when at least two components use different connection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant