Skip to content

TanoCuile/NGTokenEventBundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NGTokenEventBundle for Symfony 2.*

Allows you to create an auto-executable actions available on a unique token.

#Configure routing.yml

_token_event:
    resource: '@NGTokenEventBundle/Resources/config/routing.php'
    prefix: /

#Declaration custom event

// ...
use NG\TokenEventBundle\Events\AbstractEvent;

class EventCustom extends AbstractEvent
{
//
}

Declare as service

<service id="token_event.custom" class="Path\To\Your\TokenEvent\TokenEventCustom">
  <!--- Any arguments -->
  <tag name="ng_token_event.type" />
</service>

#Using TokenEvent

$tokenEventManager = $this->get('ng_token_event.event_manager');
        
$forwardEvent = $tokenEventManager->getEvent('forward', array(
  'routeName' => 'api',
  'routeParameters' => array('apiMethod' => 'userIsLogin')
));

// Must be enabled (FOSUserBundle)
$loginEvent = $tokenEventManager->getEvent('login', array('userId' => 4));

// Create a new token
$newToken = $tokenEventManager->createNewToken();

$newToken
    ->addEvent($forwardEvent)
    ->addEvent($loginEvent);

$tokenEventManager
        ->saveToken($newToken);

If you have any problems, you have a suggestion for improving Bundle - will be happy to listen.

About

Allows you to create an auto-executable actions available on a unique token.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages