<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
desarrolla2 / async-event-dispatcher-bundle example snippets
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Desarrolla2\AsyncEventDispatcherBundle\AsyncEventDispatcherBundle(),
);
// ...
}
// ...
}
namespace CoreBundle\Controller;
use CoreBundle\EventDispatcher\AsyncEvents;
use Desarrolla2\AsyncEventDispatcherBundle\Event\Event;
class MessageController extends AbstractController
{
public function createAction()
{
$manager = $this->container->get('desarrolla2.async_event_dispatcher');
$manager->dispatch(
AsyncEvents::NAME_EVENT,
new Event(['date' => (new \DateTime())->format('Ymd')])
);
}
}
namespace CoreBundle\EventSubscriber;
use CoreBundle\EventDispatcher\AsyncEvents;
use Desarrolla2\AsyncEventDispatcherBundle\Event\Event;
class ExampleSubscriber extends AbstractEventSubscriber
{
public static function getSubscribedEvents()
{
return [
AsyncEvents::NAME_EVENT => 'onUpdateRequested',
];
}
public function onUpdateRequested(Event $event)
{
/* CODE */
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.