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


PHP CommandContext::addParam方法代码示例

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


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

示例1: run

 public static function run($action, $parameters = array())
 {
     $command = CommandFactory::getCommand($action);
     $context = new CommandContext();
     foreach ($parameters as $key => $value) {
         $context->addParam($key, $value);
     }
     $command->execute($context);
     return $context;
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:10,代码来源:commandrunner.php

示例2: execute

 function execute(CommandContext $context)
 {
     $manager = Registry::getAccessManager();
     $user = $context->get('username');
     $pass = $context->get('pass');
     $user_obj = $manager->login($user, $pass);
     if (is_null($user_obj)) {
         $context->setError($manager->getError());
         return false;
     }
     $context->addParam("user", $user_obj);
     return true;
 }
开发者ID:jabouzi,项目名称:projet,代码行数:13,代码来源:LoginCommand.php

示例3: execute

 function execute(CommandContext $context)
 {
     $manager = ReceiverFactory::getAccessManager();
     $user = $context->get('username');
     $pass = $context->get('pass');
     $user = $manager->login($user, $pass);
     if (!$user) {
         $this->context->setError($manager->getError());
         return false;
     }
     $context->addParam("user", $user);
     return true;
 }
开发者ID:jabouzi,项目名称:projet,代码行数:13,代码来源:LoginCommand.php

示例4: execute

 function execute(CommandContext $context)
 {
     $msgSystem = ReceiverFactory::getMessageSystem();
     $email = $context->get('email');
     $msg = $context->get('pass');
     $topic = $context->get('topic');
     $result = $msgSystem->despatch($email, $msg, $topic);
     if (!$user) {
         $this->context->setError($msgSystem->getError());
         return false;
     }
     $context->addParam("user", $user);
     return true;
 }
开发者ID:jabouzi,项目名称:projet,代码行数:14,代码来源:FeedbackCommand.php

示例5: execute

 function execute(CommandContext $context)
 {
     $pageMapper = RequestRegistry::getPageMapper();
     $page = null;
     if ($context->get('page-id') != null) {
         $page = $pageMapper->find($context->get('page-id'));
     }
     if ($context->get('page-slug') != null) {
         $page = $pageMapper->findBySlug($context->get('page-slug'));
     }
     if ($page === null) {
         die("need either 'page-slug' or 'page-id' in the command context please!");
     }
     $context->addParam('page', $page);
     return;
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:16,代码来源:getpagecommand.php

示例6: execute

 function execute(CommandContext $context)
 {
     $albumMapper = RequestRegistry::getAlbumMapper();
     $album = null;
     if ($context->get('album-id') != null) {
         $album = $albumMapper->find($context->get('album-id'));
     }
     if ($context->get('album-slug') != null) {
         $album = $albumMapper->findBySlug($context->get('album-slug'));
     }
     if ($album === null) {
         $error = "Album Not Found, Check that you've sent 'album-id' or 'album-slug' in the command context, and that it's a valid slug/id";
         throw new Exception($error);
     }
     $context->addParam('album', $album);
     return;
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:17,代码来源:getalbumcommand.php

示例7: execute

 function execute(CommandContext $context)
 {
     $news = RequestRegistry::getNewsEventMapper()->findAllNewsForArchive($context->get('period'));
     $context->addParam('news', $news);
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:5,代码来源:getnewsforarchivecommand.php

示例8: execute

 function execute(CommandContext $context)
 {
     $month = $context->get('month') === null ? date('n') : $context->get('month');
     $year = $context->get('year') === null ? date('Y') : $context->get('year');
     $context->addParam('events', RequestRegistry::getNewsEventMapper()->findAllEventsForMonth($month, $year));
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:6,代码来源:geteventsformonthcommand.php

示例9: execute

 function execute(CommandContext $context)
 {
     $month = $context->get('month');
     $year = $context->get('year');
     $context->addParam('news', RequestRegistry::getNewsEventMapper()->findAllLiveNewsForMonth($month, $year));
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:6,代码来源:getlivenewsformonthcommand.php

示例10: execute

 function execute(CommandContext $context)
 {
     $context->addParam('albums', RequestRegistry::getAlbumMapper()->findAllAlbumsForIndex());
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:4,代码来源:getalbumsforindexcommand.php

示例11: execute

 function execute(CommandContext $context)
 {
     $context->addParam('newsevent', RequestRegistry::getNewsEventMapper()->findMostRecentNews());
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:4,代码来源:getmostrecentnewscommand.php

示例12: execute

 function execute(CommandContext $context)
 {
     $newsevent = RequestRegistry::getNewsEventMapper()->find($context->get('newsevent-id'));
     $context->addParam('newsevent', $newsevent);
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:5,代码来源:getnewseventcommand.php

示例13: CommandContext

<?php

require_once "command/LoginCommand.php";
require_once "command/CommandContext.php";
$context = new CommandContext();
$context->addParam("username", "bob");
$context->addParam("pass", "tiddles");
$cmd = new LoginCommand(new AccessManager());
if (!$cmd->execute($context)) {
    print "an error occurred: " . $context->getError();
} else {
    print "successful login\n";
    $user_obj = $context->get("user");
}
开发者ID:jabouzi,项目名称:projet,代码行数:14,代码来源:main.php

示例14: execute

 function execute(CommandContext $context)
 {
     $count = $context->get('count') === null ? 5 : $context->get('count');
     $context->addParam('events', RequestRegistry::getNewsEventMapper()->findRecentlyModifiedEvents($count));
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:5,代码来源:getrecentlymodifiedeventscommand.php

示例15: execute

 function execute(CommandContext $context)
 {
     $context->addParam('news', RequestRegistry::getNewsEventMapper()->findAllNews());
     return;
 }
开发者ID:awotherspoon-score,项目名称:IC,代码行数:5,代码来源:getallnewscommand.php


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