-
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
Allow to add projections via config, e.g. #11
Conversation
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
class ProjectorPass implements CompilerPassInterface |
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.
@lunetics any reason this can't be final?
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.
Sure, don't see a use case where projectorpass should / could be extended
|
||
public function process(ContainerBuilder $container) | ||
{ | ||
|
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.
@lunetics remove this empty line.
LGTM just a few cs issues. |
|
||
class ProjectorPass implements CompilerPassInterface | ||
{ | ||
const TAGNAME = 'prooph_event_store.projection'; |
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.
public / protected or private const?
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
abstract class AbstractReadModelProjectionRunner extends Command |
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.
why read model when it also handles ProjectionRunner ?
*/ | ||
private $projectionName; | ||
/** | ||
* @var ReadModel |
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.
|null
|
||
private function colors(OutputInterface $output): OutputInterface | ||
{ | ||
|
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.
remove empty line
$outputFormatter->setStyle('highlight', new OutputFormatterStyle('green', null, ['bold'])); | ||
$outputFormatter->setStyle('action', new OutputFormatterStyle('blue', null)); | ||
|
||
|
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.
one empty line too much
src/ProjectionFactory.php
Outdated
use Prooph\SnapshotStore\SnapshotStore; | ||
use PDO; | ||
|
||
class ProjectionFactory |
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.
ProjectionManagerFactory
About this: projection_class: My\Projection\FooProjection # must extends AbstractReadModelProjectionRunner and implement either ProjectionRunner or ReadModelProjectionRunner Why should I be required to extend from an abstract class, when there is an interface I can implement? |
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.
Nice stuff!
} | ||
|
||
if (null === $this->projector) { | ||
throw new RuntimeException('Projection was not be created'); |
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.
Wrong grammer in message?
Should be rebased with master, see #13 |
projection_managers: default_projection_manager: event_store: 'Prooph\EventStore\Pdo\PostgresEventStore' # event store connection: 'event_store.pdo_connection' # event store service projections: my_projection: projection_manager: default_projection_manager read_model: my_read_model # service projection_class: My\Projection\FooProjection # must extends AbstractReadModelProjectionRunner and implement either ProjectionRunner or ReadModelProjectionRunner Also tagged services are allowed. For each projection a console command will be added, named projection:<my_projection> with various actions (run, reset, delete etc)
Remove obsolete newline
Add service definition
e97a1dc
to
84302c5
Compare
Make cs happy
Did a final review and rebased the PR. Thx @lunetics for great work |
Also tagged services are allowed.
For each projection a console command will be added, named projection:<my_projection> with various actions (run, reset, delete etc)