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

Allow to add projections via config, e.g. #11

Merged
merged 12 commits into from
Sep 26, 2017
Merged

Allow to add projections via config, e.g. #11

merged 12 commits into from
Sep 26, 2017

Conversation

lunetics
Copy link
Member

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)

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class ProjectorPass implements CompilerPassInterface
Copy link
Member

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?

Copy link
Member Author

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)
{

Copy link
Member

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.

@bweston92
Copy link
Member

LGTM just a few cs issues.


class ProjectorPass implements CompilerPassInterface
{
const TAGNAME = 'prooph_event_store.projection';
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
{

Copy link
Member

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));


Copy link
Member

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

use Prooph\SnapshotStore\SnapshotStore;
use PDO;

class ProjectionFactory
Copy link
Member

Choose a reason for hiding this comment

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

ProjectionManagerFactory

@prolic
Copy link
Member

prolic commented Apr 28, 2017

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?

Copy link
Member

@mablae mablae left a 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');
Copy link
Member

Choose a reason for hiding this comment

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

Wrong grammer in message?

@codeliner
Copy link
Member

Should be rebased with master, see #13

lunetics and others added 11 commits September 26, 2017 18:48
    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
Update phpunit to v6
Require YAML component for testing
@codeliner
Copy link
Member

Did a final review and rebased the PR. Thx @lunetics for great work

@codeliner codeliner merged commit 919b55d into master Sep 26, 2017
@codeliner codeliner deleted the projections branch September 26, 2017 18:30
@codeliner codeliner mentioned this pull request Sep 26, 2017
3 tasks
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.

None yet

5 participants