-
Notifications
You must be signed in to change notification settings - Fork 39
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
Symfony 4 components support, drop < 3.3 support #33
Conversation
You properly want to have a look at https://github.com/SymfonyTest especially https://github.com/SymfonyTest/SymfonyDependencyInjectionTest |
Tests needs some cleanup and more scenarios for |
@@ -50,6 +52,7 @@ public function load(array $configs, ContainerBuilder $container) | |||
} | |||
|
|||
if (! empty($config['projections'])) { | |||
// FIXME: Missing second argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The complete block can be safely removed. projections
is not available in config.
) | ||
// TODO: Remove me | ||
->setPublic(true) | ||
->setFactory([new Reference('prooph_event_store.repository_factory'), 'create']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Factory can be moved to prooph_event_store.repository_definition
.
->setClass('%prooph_event_store.metadata_enricher_aggregate.class%'); | ||
// TODO: Remove me | ||
->setPublic(true) | ||
->setClass(MetadataEnricherAggregate::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is setClass
really necessary? It is inherited from prooph_event_store.metadata_enricher_aggregate_definition
, isn't it?
->setClass('%prooph_event_store.metadata_enricher_plugin.class%'); | ||
// TODO: Remove me | ||
->setPublic(true) | ||
->setClass(MetadataEnricherPlugin::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
@@ -156,9 +159,11 @@ private function loadEventStore(string $name, array $options, ContainerBuilder $ | |||
$eventStoreDefinition = $container | |||
->setDefinition( | |||
$eventStoreId, | |||
new DefinitionDecorator('prooph_event_store.store_definition') | |||
new ChildDefinition('prooph_event_store.store_definition') | |||
) | |||
->setFactory([new Reference('prooph_event_store.store_factory'), 'createEventStore']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Factory can be moved to prooph_event_store.store_definition
|
||
abstract class TestServices | ||
{ | ||
public const EVENT_STORE_SERVICE_ID_PREFIX = 'prooph_event_store.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I don't see a real value in adding a class for this constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel more confident with constant while refactoring, but it's not something I wll fight for.
Little value, 2 votes against - inlined in 12ebe0c
$this->compile(); | ||
|
||
$this->assertContainerBuilderHasServiceDefinitionWithArgument( | ||
sprintf('prooph_event_store.%s.%s', 'metadata_enricher_aggregate', 'foo'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sprintf
necessary?
); | ||
|
||
$this->assertContainerBuilderHasServiceDefinitionWithArgument( | ||
sprintf('prooph_event_store.%s.%s', 'metadata_enricher_aggregate', 'bar'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
In https://github.com/kejwmen/event-store-symfony-bundle/blob/e2f7b6ce2b75fcca69509d449b43bd7090282b41/src/DependencyInjection/ProophEventStoreExtension.php#L71, it should be: use Prooph\EventStore\Projection\ProjectionManager;
//
$projectionManagerDefintion
->setClass(ProjectionManager::class)
->setFactory([new Reference('prooph_event_store.projection_factory'), 'createProjectionManager']) Otherwise, given the foobar_projection_manager it will trigger an error when building the container:
|
e2f7b6c
to
12ebe0c
Compare
Thanks for review @UFOMelkor @bgaleotti. |
774310f
to
862bc60
Compare
Sorry for delay, I forgot about this PR :D Today I want to finish it, do we want to merge this: #34 before? Looks like conflicts and (maybe?) duplicated test scenarios, I can rebase and fix it, just let me know. |
What about testing private services?
Introduced these changes in 4479ab1 I know |
@kejwmen May I ask you to review #34? Merging without having a second person looking on it … ;-) |
👍 for the plugin-ServiceLocator.
While I personally dislike using the container directly, I think the event-stores and the repositories should be public. Your thoughts on this? |
So, for now the last review-comment 😉 The projection commands are accessing the container which will fail because the accessed services are not public. Perhaps another ServiceLocator as solution? The MetadataEnricher will also need some love. Currently they are also fetched from the container. Tagging them as plugins instead of handling them seperately might be a simple solution.
I would suggest to put the aliases directly into the respective Thank you for your commitment and your endurance! |
Heart says no, brain says 👍 - I don't see a valid use case to fetch them from container instead of injecting, but if there is any that can be painful to users.
ServiceLocator sounds like a good idea to start.
Good idea, simplifies things a lot.
I forgot we can put service definitions there :D Feel free to review latest commits, I will try to finish what's left tomorrow. |
e93636f
to
edba340
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
@@ -41,7 +43,8 @@ public function process(ContainerBuilder $container) | |||
|
|||
$metadataEnricherId = sprintf('prooph_event_store.%s.%s', 'metadata_enricher_plugin', $name); | |||
$metadataEnricherDefinition = $container->getDefinition($metadataEnricherId); | |||
$metadataEnricherDefinition->setClass('%prooph_event_store.metadata_enricher_plugin.class%'); | |||
$metadataEnricherDefinition->setClass(MetadataEnricherPlugin::class); | |||
$metadataEnricherDefinition->addTag(sprintf('prooph_event_store.%s.plugin', $name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to ProophEventStoreExtension
, it will fix the enrichers (MetadataEnricherPass
is executed after the PluginPass
).
test/Command/Fixture/TestKernel.php
Outdated
new ProophEventStoreBundle(), | ||
]; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add the Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass
via build
method and add the commands as services, commands should be recognized.
Testing your WIP, without any config i get: The service "Prooph\Bundle\EventStore\Command\ProjectionNamesCommand" has a dependency on a non-existent parameter "prooph_event_store.projection_managers". |
You should add the "event_store" key (definition) to the configuration (was |
@kejwmen and/or @UFOMelkor can you resolve the conflicts? I tried it but tests are failing with:
Projection manager should also be a public service I guess |
@codeliner I will take care of that later today |
thx |
@kejwmen This will remove the necessity for an own service locator for the projection managers. (more public services, the heart is bleeding^^). Actually this should have it own test and be not just part of the |
👍 test cases can be added in a separate PR. Let's finish it as soon as possible, so that teams can finally upgrade to symfony 4.0 |
Started a poll: https://twitter.com/prooph_software/status/965946184706723842 |
3ef98ad
to
f30dd90
Compare
Rebased on master and made ProjectionManagers public, but dedicated locator is still there. Should I remove it before merging? |
Pull Request Test Coverage Report for Build 144
💛 - Coveralls |
@UFOMelkor Can we merge? Once merged I'd release a new version of the bundle to communicate symfony 4.0 support 🎉 I'd say further improvements can be made in separate PRs |
LGTM 👍 |
Meant to resolve #30
@UFOMelkor do you have some specific tests in mind? Can I help somehow?
Compiler passes should get own tests for sure.
TODO:
Post rebase TODO: