本文整理汇总了PHP中Symfony\Component\EventDispatcher\GenericEvent::getArguments方法的典型用法代码示例。如果您正苦于以下问题:PHP GenericEvent::getArguments方法的具体用法?PHP GenericEvent::getArguments怎么用?PHP GenericEvent::getArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\EventDispatcher\GenericEvent
的用法示例。
在下文中一共展示了GenericEvent::getArguments方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onRoutePage
/**
* Fill template engine context with informations about current page.
*
* @param GenericEvent $event
*/
public function onRoutePage(GenericEvent $event)
{
$em = $this->registryManager->getManager();
$page = $em->getRepository('SWP\\ContentBundle\\Model\\Page')->getById($event->getArguments()['pageId'])->getArrayResult();
if (count($page)) {
$page[0]['route_name'] = $event->getArguments()['route_name'];
$this->context->setCurrentPage($page[0]);
}
return;
}
示例2: update
/**
* Update community ticker
*
* @param GenericEvent $event
* @return void
*/
public function update(GenericEvent $event)
{
$params = $event->getArguments();
$user = array_key_exists('user', $params) ? $params['user'] : null;
unset($params['user']);
$this->getRepository()->save(new CommunityTickerEvent(), array('event' => $event->getName(), 'user' => $user, 'params' => $params));
}
示例3: testGetArguments
/**
* Tests Event->getArgs()
*/
public function testGetArguments()
{
// test getting all
$this->assertSame(array('name' => 'Event'), $this->event->getArguments());
}
示例4: updateUserPoints
/**
* Update user points
*
* @param GenericEvent $event
* @return void
*/
public function updateUserPoints(GenericEvent $event)
{
$params = $event->getArguments();
$user = null;
$authorId = null;
if (array_key_exists('user', $params)) {
$user = $params['user'];
if (is_numeric($params['user'])) {
$user = $this->find($params['user']);
}
}
if (array_key_exists('authorId', $params)) {
$authorId = $params['authorId'];
}
if ($user || $authorId) {
$this->getRepository()->setUserPoints($user, $authorId);
}
}
示例5: add
public function add(GenericEvent $event, $eventName, EventDispatcherInterface $dispatcher)
{
self::$calls[] = [get_class($event->getSubject()), $event->getArguments()];
}
示例6: isCallable
/**
* Checks whether a eventConfig is appropriate to be called (subject fits, condition fits)
*
* @param Event $eventConfig
* @param GenericEvent $event
* @return bool
*/
public function isCallable(Event $eventConfig, GenericEvent $event)
{
if ($eventConfig->getSubject() && $event->getSubject() != $eventConfig->getSubject()) {
return false;
}
if ($eventConfig->getCondition()) {
$args = $event->getArguments() ?: [];
if ($eventConfig->getCondition() && !$this->conditionOperator->satisfy($eventConfig->getCondition(), $args)) {
return false;
}
}
return true;
}