本文整理汇总了PHP中sfEvent::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP sfEvent::getName方法的具体用法?PHP sfEvent::getName怎么用?PHP sfEvent::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfEvent
的用法示例。
在下文中一共展示了sfEvent::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listenToChanges
/**
* index updater event listener
*
* @param sfEvent $event
*/
public function listenToChanges(sfEvent $event)
{
$object = $event['object'];
$delete_only = in_array($event->getName(), $this->deleteEvents);
$this->removeFromIndex($object);
if (!$delete_only) {
$this->addToIndex($object);
}
}
示例2: filterValue
public function filterValue(\sfEvent $event, $value)
{
$method = $this->eventToMethod($event->getName());
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, $method)) {
$value = $plugin->{$method}($event, $value);
}
}
return $value;
}
示例3: configure
protected function configure(sfEvent $event)
{
$this->name = $event->getName();
$this->subject = $event->getSubject();
$this->arguments = $event->getParameters();
if (!$this->isEnabledForCurrentProject()) {
return false;
}
return true;
}
示例4: listenToLogEvent
/**
* Listens to command.log events.
*
* @param sfEvent $event An sfEvent instance
*/
public function listenToLogEvent(sfEvent $event)
{
$priority = isset($event['priority']) ? $event['priority'] : self::INFO;
$prefix = '';
if ('application.log' == $event->getName()) {
$subject = $event->getSubject();
$subject = is_object($subject) ? get_class($subject) : (is_string($subject) ? $subject : 'main');
$prefix = '>> ' . $subject . ' ';
}
foreach ($event->getParameters() as $message) {
$this->log(sprintf('%s%s', $prefix, $message), $priority);
}
}
示例5: handleEvent
public static function handleEvent(sfEvent $event)
{
switch ($event->getName()) {
case 'paypal.ipn_success':
$transaction = $event->getSubject();
$message = sprintf('IPN Success | Reservation: %s', $transaction->parent_id);
self::notifyPaypalEvent($message, $event['ipn_data']);
break;
case 'paypal.ipn_error':
$message = sprintf('IPN Error | %s', $event->getSubject());
self::notifyPaypalEvent($message, $event['ipn_data']);
break;
}
}
示例6: handleEvent
public static function handleEvent(sfEvent $event)
{
$reservation = $event->getSubject();
switch ($event->getName()) {
case 'reservation.pre_update':
break;
case 'reservation.post_update':
break;
case 'reservation.created':
$url = Encryption::getEncryptedUrlFromUri('@reservation_show?uniqid=' . $reservation->uniqid, $reservation->Client->User->id);
if ($reservation->Client->email_confirmed) {
$subject = 'ATC: Reservation Confirmation #' . $reservation->uniqid;
$template = 'confirm_reservation';
} else {
$subject = 'ATC: please confirm your reservation';
$template = 'request_confirmation';
}
$data = array('email_address' => $reservation->Client->email_address, 'subject' => $subject, 'url' => $url, 'reservation' => $reservation);
self::sendNotification($template, $data);
break;
}
}
示例7: filter
/**
* Filters a value by calling all listeners of a given event.
*
* @param sfEvent $event A sfEvent instance
* @param mixed $value The value to be filtered
*
* @return sfEvent The sfEvent instance
*/
public function filter(sfEvent $event, $value)
{
foreach ($this->getListeners($event->getName()) as $listener) {
$value = call_user_func_array($listener, array($event, $value));
}
$event->setReturnValue($value);
return $event;
}
示例8: dirname
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once dirname(__FILE__) . '/../lime/lime.php';
require_once dirname(__FILE__) . '/../../lib/sfEvent.php';
$t = new lime_test(11);
$subject = new stdClass();
$parameters = array('foo' => 'bar');
$event = new sfEvent($subject, 'name', $parameters);
// ->getSubject()
$t->diag('->getSubject()');
$t->is($event->getSubject(), $subject, '->getSubject() returns the event subject');
// ->getName()
$t->diag('->getName()');
$t->is($event->getName(), 'name', '->getName() returns the event name');
// ->getParameters()
$t->diag('->getParameters()');
$t->is($event->getParameters(), $parameters, '->getParameters() returns the event parameters');
// ->getReturnValue() ->setReturnValue()
$t->diag('->getReturnValue() ->setReturnValue()');
$event->setReturnValue('foo');
$t->is($event->getReturnValue(), 'foo', '->getReturnValue() returns the return value of the event');
// ->setProcessed() ->isProcessed()
$t->diag('->setProcessed() ->isProcessed()');
$event->setProcessed(true);
$t->is($event->isProcessed(), true, '->isProcessed() returns true if the event has been processed');
$event->setProcessed(false);
$t->is($event->isProcessed(), false, '->setProcessed() changes the processed status');
// ArrayAccess interface
$t->diag('ArrayAccess interface');
示例9: listenToLogEvent
/**
* Overridden command.log event so we can surpress the output of other
* tasks as we want to.
*
* This checks on the _showLog property to see if it should really report
* the log to the true listeners
*/
public function listenToLogEvent(sfEvent $event)
{
// 41 is the red error color, if it is in the string, assume error and report
$isError = strpos($event[0], '41;') !== false;
if ($this->_showLog || $isError) {
if ($event->getName() == 'command.log') {
foreach ($this->_commandLogListeners as $listener) {
call_user_func($listener, $event);
}
} elseif ($event->getName() == 'application.log') {
if ($this->_consoleApplicationLogger) {
call_user_func($this->_consoleApplicationLogger, $event);
}
}
}
}