Skip to content

Instantly share code, notes, and snippets.

@zerkalica
Created March 26, 2013 11:40
Show Gist options
  • Save zerkalica/5244775 to your computer and use it in GitHub Desktop.
Save zerkalica/5244775 to your computer and use it in GitHub Desktop.
services:
millwright_cqrs.command_bus_proto:
class: Millwright\CQRSDomain\Bus\Bus
arguments:
- []
- true
millwright_cqrs.message_bus_proto:
class: Millwright\CQRSDomain\Bus\Bus
arguments:
- []
- false
millwright_cqrs.command_bus:
class: Millwright\CQRSDomain\Bus\BusDefferer
arguments:
- @service_container
- 'millwright_cqrs.command_bus_proto'
millwright_cqrs.message_bus:
class: Millwright\CQRSDomain\Bus\BusDefferer
arguments:
- @service_container
- 'millwright_cqrs.message_bus_proto'
<?php
class BusDefferer implements BusInterface
{
protected $container;
protected $serviceName;
public function __construct(ContainerInterface $container, $serviceName)
{
$this->container = $container;
$this->serviceName = $serviceName;
}
/**
* {@inheritDoc}
*/
public function handle()
{
return call_user_func_array([$this->container->get($this->serviceName), __FUNCTION__], func_get_args());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment