boltconcepts/bdev-cqrs-bundle

This package is abandoned and no longer maintained. The author suggests using the beberlei/lite-cqrs package instead.
There is no license information available for the latest version (dev-master) of this package.

Bundle for CQRS in symfony2

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

dev-master 2013-03-11 16:21 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:24:06 UTC


README

Enables CQRS for Symfony2 application based on LiteCQRS for PHP by Benjamin Eberlei.

This bundle extends the LiteCQRS Symfony bundle with a different command bus and some useful plugins.

Build Status

Installation

Composer

"require" :  {
    // ...
    "bdev/bdev-cqrs-bundle":"dev-master",
}

Register the bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new LiteCQRS\Plugin\SymfonyBundle\LiteCQRSBundle(),
        new BDev\Bundle\RoutingExtraBundle\BDevRoutingExtraBundle(),
    );
    // ...
}

Configure the bundle

# app/config/config.yml
bdev_cqrs:
    command_validation: true # default is false

Usage

Let's assume that you have read the LiteCQRS for PHP Readme.

Defining a command or event handler should now be done in the scope "command" (this is not forced just best practice).

The command_bus service now expects command triggered from outside the scope to be called using execute and not handle from within your command/event handlers handle should be used.

The execute method also has the nice extra that the command handler for this command can return a value/object (this saves you from having to make your controllers event handlers).

<?php
// Controller class
public function someAction() {
    // ...
    $id = $this->get('command_bus')->execute($command);
}

Command Validator

The Command Validator plugin will execute the validator belonging to a command when it is executed/handled.

TODO

  • Add security plugin for the command and event handlers
  • Write some good docs