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


PHP sfEvent::setReturnValue方法代码示例

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


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

示例1: componentMethodNotFound

 public function componentMethodNotFound(sfEvent $event)
 {
     $actions = $event->getSubject();
     $method = $event['method'];
     $args = $event['arguments'];
     if ($method == 'getEntityManager') {
         $databaseManager = $actions->getContext()->getDatabaseManager();
         $names = $databaseManager->getNames();
         if ($args) {
             $name = $args[0];
             if (!in_array($name, $names)) {
                 throw new sfException(sprintf('Could not get the entity manager for ' . 'the database connection named: "%s"', $name));
             }
             $database = $databaseManager->getDatabase($args[0]);
         } else {
             $database = $databaseManager->getDatabase(end($names));
         }
         $event->setReturnValue($database->getEntityManager());
         return true;
     } else {
         if ($method == 'getEntityManagerFor') {
             $entityName = $args[0];
             if (is_object($entityName)) {
                 $entityName = get_class($entityName);
             }
             $databaseManager = $actions->getContext()->getDatabaseManager();
             $names = $databaseManager->getNames();
             foreach ($names as $name) {
                 $em = $databaseManager->getDatabase($name)->getEntityManager();
                 $cmf = $em->getMetadataFactory();
                 if ($cmf->hasMetadataFor($entityName)) {
                     $event->setReturnValue($em);
                     return true;
                 }
             }
             return false;
         } else {
             if ($method == 'getMetadataFor') {
                 $entityName = $args[0];
                 if (is_object($entityName)) {
                     $entityName = get_class($entityName);
                 }
                 $databaseManager = $actions->getContext()->getDatabaseManager();
                 $names = $databaseManager->getNames();
                 foreach ($names as $name) {
                     $em = $databaseManager->getDatabase($name)->getEntityManager();
                     $cmf = $em->getMetadataFactory();
                     if ($cmf->hasMetadataFor($entityName)) {
                         $event->setReturnValue($cmf->getMetadataFor($entityName));
                         return true;
                     }
                 }
                 return false;
             } else {
                 return false;
             }
         }
     }
 }
开发者ID:blt04,项目名称:sfDoctrine2Plugin,代码行数:59,代码来源:sfDoctrine2PluginConfiguration.class.php

示例2: listenToHandleHeader

 public static function listenToHandleHeader(sfEvent $event)
 {
     switch ($event['header']) {
         case 'AuthHeader':
             $event->setReturnValue(self::handleAuthHeader($event['data']));
             break;
         case 'ExtraHeader':
             $event->setReturnValue(self::handleExtraHeader($event['data']));
             break;
         default:
             return false;
     }
     return true;
 }
开发者ID:nvieirafelipe,项目名称:graviola-project,代码行数:14,代码来源:SoapHeaderListener.class.php

示例3: listenToContextMethodNotFoundEvent

 public function listenToContextMethodNotFoundEvent(sfEvent $event)
 {
     $parameters = $event->getParameters();
     if ('getFacebook' != $parameters['method']) {
         return false;
     }
     if ($this->_facebook instanceof sfFacebook) {
         $event->setReturnValue($this->_facebook);
         return true;
     }
     $this->_facebook = new sfFacebook($this->dispatcher);
     $event->setReturnValue($this->_facebook);
     $this->dispatcher->notify(new sfEvent($this, 'facebook.configure'));
     return true;
 }
开发者ID:JoshuaEstes,项目名称:sfDoctrineFacebookPlugin,代码行数:15,代码来源:sfDoctrineFacebookPluginConfiguration.class.php

示例4: processApplicationConfirm

 public function processApplicationConfirm(sfEvent $event)
 {
     $app = sfConfig::get('sf_app');
     $invite = Doctrine::getTable('ApplicationInvite')->find($event['id']);
     if (!$invite) {
         return false;
     }
     $application = $invite->getApplication();
     if ('pc_frontend' === $app) {
         if (!$application->getIsPc()) {
             return false;
         }
     } elseif ('mobile_frontend' === $app) {
         if (!$application->getIsMobile()) {
             return false;
         }
     }
     if ($event['is_accepted']) {
         $action = $event->getSubject();
         if ($action instanceof sfAction) {
             $action->redirect('@application_add?id=' . $application->getId() . '&invite=' . $invite->getId());
         }
     } else {
         $invite->delete();
         $event->setReturnValue("You have just rejected request of invitation to app.");
     }
     return true;
 }
开发者ID:niryuu,项目名称:opOpenSocialPlugin,代码行数:28,代码来源:PluginApplicationInviteTable.class.php

示例5: listenToMethodNotFound

 /**
  * Listens to component.method_not_found event.
  *
  * @param  sfEvent A sfEvent instance
  *
  * @return Boolean true if the method has been found in this class, false otherwise
  */
 public function listenToMethodNotFound(sfEvent $event)
 {
     if (!method_exists($this, $method = $event['method'])) {
         return false;
     }
     $event->setReturnValue(call_user_func(array($this, $method), $event->getSubject()));
     return true;
 }
开发者ID:ntemple,项目名称:intelli-plancake,代码行数:15,代码来源:sfSslRequirementActionMixin.class.php

示例6: newMethod

 public static function newMethod(sfEvent $event)
 {
     if ($event['method'] == 'newMethod') {
         $arguments = $event['arguments'];
         $event->setReturnValue($arguments[0]);
         return true;
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:8,代码来源:sfEventDispatcherTest.class.php

示例7: call

 /**
  * Adds 1.0 compatibility methods to the request object.
  *
  * @param sfEvent $event The event
  *
  * @return Boolean true if the method has been found here, false otherwise
  */
 public static function call(sfEvent $event)
 {
     if (!in_array($event['method'], array('getError', 'getErrorNames', 'getErrors', 'hasError', 'hasErrors', 'removeError', 'setError', 'setErrors', 'getFile', 'getFileError', 'getFileName', 'getFileNames', 'getFilePath', 'getFileSize', 'getFileType', 'hasFile', 'hasFileError', 'hasFileErrors', 'hasFiles', 'getFileValue', 'getFileValues', 'getFileExtension', 'moveFile'))) {
         return false;
     }
     $event->setReturnValue(call_user_func_array(array('sfRequestCompat10', $event['method']), array_merge(array($event->getSubject()), $event['arguments'])));
     return true;
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:15,代码来源:sfRequestCompat10.class.php

示例8: listenToHelperMethodNotFoundEvent

 public function listenToHelperMethodNotFoundEvent(sfEvent $event)
 {
     if (method_exists($this, $event['method'])) {
         $event->setReturnValue(call_user_func_array(array($this, $event['method']), $event['arguments']));
         return true;
     }
     return false;
 }
开发者ID:jdart,项目名称:diem,代码行数:8,代码来源:dmFrontHelperExtension.php

示例9: handleException

 public static function handleException(sfEvent $event)
 {
     $moduleName = sfConfig::get('sf_error_500_module', 'connexion');
     $actionName = sfConfig::get('sf_error_500_action', 'error500');
     sfContext::getInstance()->getRequest()->addRequestParameters(array('exception' => $event->getSubject()));
     $event->setReturnValue(true);
     sfContext::getInstance()->getController()->forward($moduleName, $actionName);
 }
开发者ID:lendji4000,项目名称:compose,代码行数:8,代码来源:EiError.class.php

示例10: observeMethodNotFound

 public static function observeMethodNotFound(sfEvent $event)
 {
     if (method_exists('sfActionExtra', $event['method'])) {
         $args = array_merge(array($event->getSubject()), $event['arguments']);
         $ret = call_user_func_array(array('sfActionExtra', $event['method']), $args);
         $event->setReturnValue($ret);
         return $ret;
     }
 }
开发者ID:robertsergio,项目名称:Hadori-Demo,代码行数:9,代码来源:sfActionExtra.class.php

示例11: listenSetThemeFromRequest

 public function listenSetThemeFromRequest(sfEvent $event)
 {
     $context = $event['context'];
     if ($context->getModuleName() == 'controller' && $context->getActionName() == 'eventListener') {
         $event->setReturnValue('test_theme');
         return true;
     }
     return false;
 }
开发者ID:rafaelgou,项目名称:sfThemePlugin,代码行数:9,代码来源:frontendConfiguration.class.php

示例12: listenToComponentMethodNotFoundEvent

 /**
  * Listens to the component.method_not_found event.
  *
  * @param sfEvent $event An sfEvent instance
  *
  * @return bool True, if the method is the 'isSoapRequest', false otherwise
  */
 public static function listenToComponentMethodNotFoundEvent(sfEvent $event)
 {
     if ($event['method'] == 'isSoapRequest') {
         $event->setReturnValue(self::isSoapRequest());
         return true;
     } else {
         return false;
     }
 }
开发者ID:psskhal,项目名称:symfony-sample,代码行数:16,代码来源:ckComponentEventListener.class.php

示例13: observe

 /**
  * Get the current tracker object.
  * 
  * @param   sfEvent $event
  * 
  * @return  bool
  */
 public static function observe(sfEvent $event)
 {
     switch ($event['method']) {
         case 'getGemiusTrafficTracker':
             $event->setReturnValue(sfGemiusTrafficMixin::getTracker());
             return true;
         case 'setGemiusTrafficTracker':
             sfGemiusTrafficMixin::setTracker($event['arguments'][0]);
             return true;
     }
 }
开发者ID:tomi77,项目名称:sfGemiusTrafficPlugin,代码行数:18,代码来源:sfGemiusTrafficListener.class.php

示例14: observe

 /**
  * Get the current tracker object.
  * 
  * @param   sfEvent $event
  * 
  * @return  bool
  */
 public static function observe(sfEvent $event)
 {
     $subject = $event->getSubject();
     switch ($event['method']) {
         case 'getTracker':
             $event->setReturnValue(sfGoogleAnalyticsMixin::getTracker($subject));
             return true;
         case 'setTracker':
             sfGoogleAnalyticsMixin::setTracker($subject, $event['arguments'][0]);
             return true;
     }
 }
开发者ID:robinkanters,项目名称:dnsleergemeenschap,代码行数:19,代码来源:sfGoogleAnalyticsListener.class.php

示例15: processFriendConfirm

 public static function processFriendConfirm(sfEvent $event)
 {
     $toMember = Doctrine::getTable('Member')->find($event['id']);
     $relation = Doctrine::getTable('MemberRelationship')->retrieveByFromAndTo($event['member']->id, $toMember->id);
     if (!$relation) {
         $relation = Doctrine::getTable('MemberRelationship')->create(array('member_id_from' => $event['member']->id, 'member_id_to' => $toMember->id));
     }
     if (!$relation->isFriendPreTo()) {
         return false;
     }
     if ($event['is_accepted']) {
         $relation->setFriend();
         $event->setReturnValue('You have just accepted %friend% link request.');
         $params = array('subject' => sfContext::getInstance()->getI18N()->__('%1% accepted your %friend% link request', array('%1%' => $event['member']->getName())), 'member' => $event['member']);
         opMailSend::sendTemplateMail('friendLinkComplete', $toMember->getEmailAddress(), opConfig::get('admin_mail_address'), $params);
     } else {
         $event->setReturnValue('You have just rejected %friend% link request.');
         $relation->removeFriendPre();
     }
     return true;
 }
开发者ID:TadahiroKudo,项目名称:OpenPNE3,代码行数:21,代码来源:MemberRelationshipTable.class.php


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