本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例7: execute
function execute(CommandContext $context)
{
$news = RequestRegistry::getNewsEventMapper()->findAllNewsForArchive($context->get('period'));
$context->addParam('news', $news);
}
示例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));
}
示例9: execute
function execute(CommandContext $context)
{
$month = $context->get('month');
$year = $context->get('year');
$context->addParam('news', RequestRegistry::getNewsEventMapper()->findAllLiveNewsForMonth($month, $year));
}
示例10: execute
function execute(CommandContext $context)
{
$context->addParam('albums', RequestRegistry::getAlbumMapper()->findAllAlbumsForIndex());
}
示例11: execute
function execute(CommandContext $context)
{
$context->addParam('newsevent', RequestRegistry::getNewsEventMapper()->findMostRecentNews());
}
示例12: execute
function execute(CommandContext $context)
{
$newsevent = RequestRegistry::getNewsEventMapper()->find($context->get('newsevent-id'));
$context->addParam('newsevent', $newsevent);
}
示例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");
}
示例14: execute
function execute(CommandContext $context)
{
$count = $context->get('count') === null ? 5 : $context->get('count');
$context->addParam('events', RequestRegistry::getNewsEventMapper()->findRecentlyModifiedEvents($count));
}
示例15: execute
function execute(CommandContext $context)
{
$context->addParam('news', RequestRegistry::getNewsEventMapper()->findAllNews());
return;
}