当前位置: 首页>>代码示例>>PHP>>正文


PHP sfEvent::setProcessed方法代码示例

本文整理汇总了PHP中sfEvent::setProcessed方法的典型用法代码示例。如果您正苦于以下问题:PHP sfEvent::setProcessed方法的具体用法?PHP sfEvent::setProcessed怎么用?PHP sfEvent::setProcessed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfEvent的用法示例。


在下文中一共展示了sfEvent::setProcessed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listenToMethodNotFound

 public function listenToMethodNotFound(sfEvent $event)
 {
     $parameters = $event->getParameters();
     if ($parameters['method'] == 'defineCombinedAssets') {
         $this->loaded_assets = count($parameters['arguments']) > 0 ? $parameters['arguments'][0] : array();
         $event->setProcessed(true);
     }
     if ($parameters['method'] == 'getCombinedAssets') {
         $event->setReturnValue($this->loaded_assets);
         $event->setProcessed(true);
     }
 }
开发者ID:rande,项目名称:swCombinePlugin,代码行数:12,代码来源:swCombinePluginConfiguration.class.php

示例2: extend

 public function extend(sfEvent $event)
 {
     $this->_subject = $event->getSubject();
     $method = $event['method'];
     $arguments = $event['arguments'];
     if (method_exists($this, $method)) {
         $result = call_user_func_array(array($this, $method), $arguments);
         $event->setProcessed(true);
         $event->setReturnValue($result);
         return true;
     } else {
         return false;
     }
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:14,代码来源:sfSympalExtendClass.class.php

示例3: listenToFormMethodNotFound

 /**
  * Listen to the form.method_not_found event
  * 
  * @param sfEvent $event
  * @return void
  */
 public static function listenToFormMethodNotFound(sfEvent $event)
 {
     $form = $event->getSubject();
     // do not process events of non-object forms
     if (!$form instanceof BaseFormDoctrine || $form instanceof FakeObjectForm) {
         return;
     }
     switch (strtolower($event['method'])) {
         case 'setobject':
             if (count($event['arguments']) !== 1) {
                 throw new InvalidArugmentException('The number of arguments is invalid.');
             }
             self::setObject($form, $event['arguments'][0]);
             $event->setProcessed(true);
             break;
         case 'embedcollection':
             if (count($event['arguments']) < 2 || count($event['arguments']) > 3) {
                 throw new InvalidArgumentException('The number of arguments is invalid.');
             }
             self::embedCollection($form, $event['arguments'][0], $event['arguments'][1], isset($event['arguments'][2]) ? $event['arguments'][2] : array());
             $event->setProcessed(true);
             break;
     }
 }
开发者ID:schmittjoh,项目名称:jmsFormsPlugin,代码行数:30,代码来源:jmsBaseFormDoctrine.class.php

示例4: run

 public function run(sfEvent $event)
 {
     if (isset($event['pager'])) {
         $pager = $event['pager'];
         $context = sfContext::getInstance();
         $response = $context->getResponse();
         $request = $context->getRequest();
         $className = 'sf' . ucfirst($event['format']) . 'Feed';
         if (!class_exists($className)) {
             return false;
         }
         $feed = sfFeedPeer::newInstance($event['format']);
         $feed->initialize(array('title' => $response->getTitle(), 'link' => $request->getUri()));
         $items = sfFeedPeer::convertObjectsToItems($pager->getResults());
         $feed->addItems($items);
         $event->setProcessed(true);
         $event->setReturnValue($feed->asXml());
         $request->setRequestFormat($event['format']);
         return true;
     } else {
         return false;
     }
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:23,代码来源:sfSympalContentRendererUnknownFormatListener.class.php

示例5: listenOnComponentMethodNotFoundEvent

 /**
  * Listens on "component.method_not_found"
  *
  * @param sfEvent $event
  * @return null
  */
 public static function listenOnComponentMethodNotFoundEvent(sfEvent $event)
 {
     try {
         $callable = array(new sfViewCacheTagManagerBridge($event->getSubject()), $event['method']);
         $value = call_user_func_array($callable, $event['arguments']);
         $event->setReturnValue($value);
         $event->setProcessed(true);
     } catch (BadMethodCallException $e) {
         $event->setProcessed(false);
     } catch (sfException $e) {
         $event->setProcessed(true);
         self::notifyApplicationLog(__CLASS__, $e->getMessage(), sfLogger::NOTICE);
     }
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:20,代码来源:sfCacheTaggingToolkit.class.php

示例6: catch

// ->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');
$t->is($event['foo'], 'bar', 'sfEvent implements the ArrayAccess interface');
$event['foo'] = 'foo';
$t->is($event['foo'], 'foo', 'sfEvent implements the ArrayAccess interface');
try {
    $event['foobar'];
    $t->fail('::offsetGet() throws an InvalidArgumentException exception when the parameter does not exist');
} catch (InvalidArgumentException $e) {
    $t->pass('::offsetGet() throws an InvalidArgumentException exception when the parameter does not exist');
}
$t->ok(isset($event['foo']), 'sfEvent implements the ArrayAccess interface');
开发者ID:ubermuda,项目名称:PHPInteractiveShell,代码行数:31,代码来源:sfEventTest.php

示例7: handleMemoryLimitEvent

 public function handleMemoryLimitEvent(sfEvent $event)
 {
     // store the current state
     $this->saveState($event['model'], array('limit' => $event['limit'], 'page' => $event['page']));
     $event->setProcessed(true);
 }
开发者ID:rande,项目名称:sfSolrPlugin,代码行数:6,代码来源:sfLuceneUpdateModelTask.class.php


注:本文中的sfEvent::setProcessed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。