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


PHP GenericEvent::setArgument方法代码示例

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


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

示例1: up

 /**
  * Starts a new phantomjs process in background
  *
  * @throws \Symfony\Component\Process\Exception\RuntimeException
  */
 public function up()
 {
     $this->killAllRunning();
     $this->process = new Process('phantomjs --webdriver=' . $this->port . ' ' . $this->options);
     $process = $this->process;
     $output = new GenericEvent();
     $process->setTimeout(null);
     $process->start(function () use($process, $output) {
         $output->setArgument('output', $process->getIncrementalOutput());
     });
     $phantomjsOnline = false;
     $portScan = false;
     while (!$phantomjsOnline) {
         if ($output->hasArgument('output')) {
             $portScan = strpos($output->getArgument('output'), 'running on port ' . $this->port);
         }
         if ($portScan) {
             echo $output->getArgument('output');
         }
         $phantomjsOnline = $process->isStarted() && $process->isRunning() && $portScan;
         if ($process->isTerminated()) {
             throw new RuntimeException('Phantomjs could not been started with webdriver on port ' . $this->port);
         }
     }
 }
开发者ID:mazelab,项目名称:phantomjsstarter,代码行数:30,代码来源:Starter.php

示例2: generateEditorLink

 /**
  * Generates editor's link
  *
  * @param GenericEvent $event Symfony Event
  */
 public function generateEditorLink(GenericEvent $event)
 {
     $articleNumber = $event->getArgument('articleNumber');
     $articleLanguage = $event->getArgument('articleLanguage');
     if ($this->pluginsService->isEnabled($this->getPluginName()) && $this->hasAccessToEditor()) {
         $articleLink = $this->router->generate('newscoop_admin_aes', array('articleNumber' => $articleNumber, 'language' => $articleLanguage));
     }
     $event->setArgument('link', $articleLink);
 }
开发者ID:AtomLaw,项目名称:plugin-Scoopwriter,代码行数:14,代码来源:EditorListener.php

示例3: beforeAction

 /**
  * Before action handler
  *
  * @param GenericEvent $event
  * @return void
  */
 protected function beforeAction(GenericEvent $event)
 {
     // Check if user logged in
     if (!$this->authEnabled || $this->user->isValid()) {
         return;
     }
     // Access denied
     if ($this->http->isJsonRpc()) {
         $data = ['jsonrpc' => '2.0', 'id' => null, 'error' => ['number' => 403, 'message' => 'Permission denied']];
         $response = new JsonResponse($data, 403);
         $event->setArgument('response', $response);
     } else {
         // Redirect to login
         $url = $this->http->getBaseUrl('login');
         $response = new RedirectResponse($url);
         $event->setArgument('response', $response);
     }
 }
开发者ID:odan,项目名称:molengo,代码行数:24,代码来源:Controller.php

示例4: testSetArgument

 public function testSetArgument()
 {
     $result = $this->event->setArgument('foo2', 'bar2');
     $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event);
     $this->assertEquals($this->event, $result);
 }
开发者ID:carlyns,项目名称:RESUSblog,代码行数:6,代码来源:GenericEventTest.php

示例5: update

 public function update(IEntity $entity)
 {
     $eventPre = new GenericEvent($entity);
     $this->eventDispatcher->dispatch("pre-update-" . $this->entityName, new GenericEvent($entity));
     $return = $this->db->update($this->table, $entity->deshydrater(), array('id' => $entity->getId()));
     $eventPost = new GenericEvent($eventPre->getSubject());
     $eventPost->setArgument("nombreResultat", $return);
     $this->eventDispatcher->dispatch("post-update-" . $this->entityName, new GenericEvent($entity));
     return $return;
 }
开发者ID:fabricekabongo,项目名称:common,代码行数:10,代码来源:Repository.php

示例6: triggerRequest

 /**
  * Triggers a workflow request, queries a permission key to see what workflows are attached to it
  * and initiates them.
  *
  * @param \PermissionKey $pk
  *
  * @return optional WorkflowProgress
  */
 protected function triggerRequest(\PermissionKey $pk)
 {
     if (!$this->wrID) {
         $this->save();
     }
     if (!$pk->canPermissionKeyTriggerWorkflow()) {
         throw new \Exception(t('This permission key cannot start a workflow.'));
     }
     $pa = $pk->getPermissionAccessObject();
     $workflows = array();
     $workflowsStarted = 0;
     if (is_object($pa)) {
         $workflows = $pa->getWorkflows();
         foreach ($workflows as $wf) {
             if ($wf->validateTrigger($this)) {
                 $wp = $this->addWorkflowProgress($wf);
                 ++$workflowsStarted;
                 $event = new GenericEvent();
                 $event->setArgument('progress', $wp);
                 Events::dispatch('workflow_triggered', $event);
             }
         }
     }
     if (isset($wp)) {
         return $wp->getWorkflowProgressResponseObject();
     }
     if ($workflowsStarted == 0) {
         $defaultWorkflow = new EmptyWorkflow();
         $wp = $this->addWorkflowProgress($defaultWorkflow);
         $event = new GenericEvent();
         $event->setArgument('progress', $wp);
         Events::dispatch('workflow_triggered', $event);
         return $wp->getWorkflowProgressResponseObject();
     }
 }
开发者ID:seebaermichi,项目名称:concrete5,代码行数:43,代码来源:Request.php

示例7: runTask

 /**
  * Attempts to run a workflow task on the bound WorkflowRequest object first, then if that doesn't exist, attempts to run
  * it on the current WorkflowProgress object.
  *
  * @return WorkflowProgressResponse
  */
 public function runTask($task, $args = array())
 {
     $wf = $this->getWorkflowObject();
     if (in_array($task, $wf->getAllowedTasks())) {
         $wpr = call_user_func_array(array($wf, $task), array($this, $args));
         $this->updateOnAction($wf);
     }
     if (!$wpr instanceof Response) {
         $wpr = new Response();
     }
     $event = new GenericEvent();
     $event->setArgument('response', $wpr);
     Events::dispatch('workflow_progressed', $event);
     return $wpr;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:21,代码来源:Progress.php

示例8: onAuthenticationSuccess

 protected function onAuthenticationSuccess($response)
 {
     $e = new GenericEvent($response);
     $e->setArgument('result', '');
     return $this->app['dispatcher']->dispatch(self::EVENT_SUCCESS, $e)->getArgument('result');
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:6,代码来源:OpauthExtension.php

示例9: addBucket

 /**
  * @param  string | \Kbrw\RiakBundle\Model\Bucket\Bucket $bucket
  * @param  boolean                                       $buildFromCluster
  * @return \Kbrw\RiakBundle\Model\Bucket\Bucket
  */
 public function addBucket(&$bucket, $buildFromCluster = false)
 {
     if ($buildFromCluster) {
         $bucketName = $bucket instanceof \Kbrw\RiakBundle\Model\Bucket\Bucket ? $bucket->getName() : $bucket;
         $bucket = $this->bucketProperties($bucketName);
     }
     if (!$bucket instanceof \Kbrw\RiakBundle\Model\Bucket\Bucket) {
         $bucket = new Bucket($bucket);
     }
     $bucket->setRiakBucketServiceClient($this->riakBucketServiceClient);
     $bucket->setRiakKVServiceClient($this->riakKVServiceClient);
     $bucket->setRiakSearchServiceClient($this->riakSearchServiceClient);
     $bucket->setCluster($this);
     if (isset($this->eventDispatcher)) {
         $event = new GenericEvent("riak.bucket.add");
         $event->setArgument("bucket", $bucket);
         $this->eventDispatcher->dispatch("riak.bucket.add", $event);
     }
     $this->buckets[$bucket->getName()] = $bucket;
     return $bucket;
 }
开发者ID:shopping-adventure,项目名称:RiakBundle,代码行数:26,代码来源:Cluster.php


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