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

Add aliases to help autowiring #640

Merged
merged 1 commit into from
Mar 26, 2017
Merged

Conversation

nicolas-grekas
Copy link
Member

No description provided.

@nicolas-grekas nicolas-grekas force-pushed the autow-alias branch 2 times, most recently from fb1c2e9 to 0ce61a3 Compare March 21, 2017 21:40
@@ -126,6 +126,7 @@ protected function dbalLoad(array $config, ContainerBuilder $container)

$container->setAlias('database_connection', sprintf('doctrine.dbal.%s_connection', $this->defaultConnection));
$container->setAlias('doctrine.dbal.event_manager', new Alias(sprintf('doctrine.dbal.%s_connection.event_manager', $this->defaultConnection), false));
$container->setAlias('Doctrine\DBAL\Driver\Connection', new Alias('database_connection', false));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest putting this directly in dbal.xml, as it does not need to be dynamic based on the configuration

@@ -373,6 +374,8 @@ protected function ormLoad(array $config, ContainerBuilder $container)
}

$container->setAlias('doctrine.orm.entity_manager', sprintf('doctrine.orm.%s_entity_manager', $config['default_entity_manager']));
$container->setAlias('Doctrine\ORM\EntityManagerInterface', new Alias('doctrine.orm.entity_manager', false));
$container->setAlias('Doctrine\Common\Persistence\ObjectManager', new Alias('doctrine.orm.entity_manager', false));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for these (but in orm.xml)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@nicolas-grekas nicolas-grekas force-pushed the autow-alias branch 3 times, most recently from 7842250 to 38748da Compare March 26, 2017 14:13
@@ -116,36 +116,6 @@ public function testGetUnknownEntityManager()
$registry->getManager('default');
}

public function testResetDefaultEntityManager()
Copy link
Member Author

@nicolas-grekas nicolas-grekas Mar 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two tests rely on deprecated behavior, and do not test things in the bundle, be behavior in the doctrine bridge. Since it's not the responsibility of the bundle to test the bridge, they can and should be removed.

@nicolas-grekas
Copy link
Member Author

Remaining failure will be fixed once symfony/symfony#22164 is merged up to 2.8.

@fabpot
Copy link
Member

fabpot commented Mar 26, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit e421a83 into doctrine:master Mar 26, 2017
fabpot added a commit that referenced this pull request Mar 26, 2017
This PR was merged into the 1.6.x-dev branch.

Discussion
----------

Add aliases to help autowiring

Commits
-------

e421a83 Add aliases to help autowiring
@nicolas-grekas nicolas-grekas deleted the autow-alias branch June 11, 2017 08:57
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.

3 participants