當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。