-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
Allow usage of different entity managers/connections in CLI #97
Comments
Was there anything fundamentally wrong with brettalewis' solution in commit 62d5592f3d9312c20ee3525b2b6e8466229ca084 apart from lack of testing? |
That's terribly patched up, and adds the option to all commands (even not doctrine related). What I'm thinking of is to move everything to zf2 controllers instead |
+1 |
any news on this issue? is anyone working on it? |
This will be possible in doctrine/DoctrineModule#256 |
Can you give me a hint, which change makes it possible? I only found https://github.com/doctrine/DoctrineModule/pull/256/files#L3R87 these comments about alias usage. Are any changes needed on DoctrineORMModule side for that? |
@Mischosch the idea is that you have a If you replace |
Any news on this? Is this possible now or maybe there are some workarounds for now? |
Here's a workaround that worked for me: https://gist.github.com/adamlundrigan/c0c87fc5657453212cd0 |
@vladar I created this small module https://github.com/SwissEngine/Doctrine-Module-Extension to implement --em=orm_custom for all commands from the CLI. Ocramius says it's not ideal but it works for the moment. 1.x seems dead. |
What about this issue ? May I suggest a PR ? |
@SwissEngine I just tried using your Doctrine-Module-Extension. It worked fine when the entity manager is call from some commands but when I run a migration command (eg doctrine-module orm:schema-tool:create --em=orm_alternative) it still just picks up the orm_default configuration. It looks to me like this is because of the following lines in DoctrineORMModule Is that correct or have I just got my configuration wrong? // @TODO currently hardcoded: `orm_default` should be injected
/* @var $configuration \Doctrine\DBAL\Migrations\Configuration\Configuration */
$configuration = $serviceLocator->get('doctrine.migrations_configuration.orm_default');
/* @var $command \Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand */
$command = new $className; |
@duncanfwalker I have the same problem. It works for me (@SwissEngine thank you!) with So two problems (solving either solves our problem, but solving both would be best):
-edit- duncanfwalker is right, it doesn't work with all migrations commands |
thanks for taking the time to explain - I will have a look this when I next On 18 December 2015 at 20:54, bvarent notifications@github.com wrote:
|
I have 4 entity managers configured, none of which are called 'orm_default'. In this case the CLI doesn't event load.
I cannot simply add it as an service alias as it could be any of the 4 entity managers I need. |
this issue is almost 4 years old... any news/solutions on it except for using https://github.com/SwissEngine/Doctrine-Module-Extension ? |
Fixed with #524 |
Sorry @TomHAnderson but the issue with doctrine-migrations still exist. |
@MatthiasKuehneEllerhold thanks for chiming in. Because you are the only one to mention doctrine-migrations specifically I can't grok what part of this bug is still at issue. In my experience the failure to echo the commands as they are executed has been fixed. If you are still having trouble will you please create a new ticket and explain the problem you still see. |
It may be interesting to provide a helper (or custom Symfony Application) that replaces the EntityManager or DBAL Connection helpers based on a provided parameter such as
--em=name_of_em_service
The text was updated successfully, but these errors were encountered: