本文整理汇总了PHP中AgaviRequestDataHolder::hasParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP AgaviRequestDataHolder::hasParameter方法的具体用法?PHP AgaviRequestDataHolder::hasParameter怎么用?PHP AgaviRequestDataHolder::hasParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AgaviRequestDataHolder
的用法示例。
在下文中一共展示了AgaviRequestDataHolder::hasParameter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeWrite
public function executeWrite(AgaviRequestDataHolder $request_data)
{
$size = $request_data->getParameter('size', 1);
$aggregate_root_type = $request_data->getParameter('type');
$fixture_service = $this->getServiceLocator()->getFixtureService();
$type_prefix = $aggregate_root_type->getPrefix();
$documents[$type_prefix] = $fixture_service->generate($type_prefix, $size);
$json = json_encode($documents, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$errors = [];
$report = [];
$success = true;
if ($request_data->hasParameter('target')) {
$target = $request_data->getParameter('target');
if (is_writable(dirname($target))) {
$success = file_put_contents($target, $json, LOCK_EX) !== false;
if (!$success) {
$errors[] = sprintf('failed to write to: %s', $target);
}
} else {
$errors[] = sprintf('target filename is not writable: %s', $target);
$success = false;
}
} else {
$this->setAttribute('data', $json);
}
$this->setAttribute('report', $report);
$this->setAttribute('size', count($documents[$type_prefix]));
if (!$success) {
$this->setAttribute('errors', $errors);
return 'Error';
}
return 'Success';
}
示例2: makeRequestDataStruct
/**
* Creates the right data structure to call the cronk script interface
* @param AgaviRequestDataHolder $rd
* @return array
*/
public static function makeRequestDataStruct(AgaviRequestDataHolder $rd)
{
$data = array();
foreach (self::$requestAttributes as $attr) {
if ($rd->hasParameter($attr)) {
$data[$attr] = $rd->getParameter($attr);
}
}
return $data;
}
示例3: executeWrite
public function executeWrite(AgaviRequestDataHolder $request_data)
{
if ($request_data->hasParameter('command')) {
$create_command = $request_data->getParameter('command');
$this->dispatchCommand($create_command);
$this->setAttribute('command', $create_command);
} else {
$this->setAttribute('resource_type', $this->getProjectionType());
}
return 'Success';
}
示例4: executeWrite
public function executeWrite(AgaviRequestDataHolder $request_data)
{
$service_locator = $this->getServiceLocator();
$migration_service = $service_locator->getMigrationService();
$migrated_targets = [];
if (!$request_data->hasParameter('target') || MigrationTargetValidator::ALL_TARGETS === $request_data->getParameter('target')) {
if ($request_data->hasParameter('version')) {
throw new RuntimeError("Version parameter only supported together with a valid target.");
}
foreach ($migration_service->getMigrationTargetMap() as $target_name => $migration_target) {
if ($migration_target->isActivated()) {
$migrated_targets[$target_name] = ['target' => $migration_target, 'migrations' => $migration_service->migrate($target_name)];
}
}
} else {
$target_name = $request_data->getParameter('target');
$target_version = $request_data->getParameter('version');
$migrated_targets[$target_name] = ['target' => $migration_service->getMigrationTarget($target_name), 'migrations' => $migration_service->migrate($target_name, $target_version)];
}
$this->setAttribute('migrated_targets', $migrated_targets);
return 'Success';
}
示例5: executeConsole
public function executeConsole(AgaviRequestDataHolder $request_data)
{
$state_machine = $request_data->getParameter('subject');
$svg = $this->renderSubject($state_machine);
if ($request_data->hasParameter('output')) {
$output = $request_data->getParameter('output');
file_put_contents($output, $svg);
$message = sprintf('-> successfully generated visualization for "%s"' . PHP_EOL . '-> image was generated here: %s', $state_machine->getName(), realpath($output));
return $this->cliMessage($message);
} else {
return $svg;
}
}
示例6: executeJson
public function executeJson(AgaviRequestDataHolder $rd)
{
$factory = $this->getContext()->getModel('JasperSoapFactory', 'Reporting', array('jasperconfig' => $rd->getParameter('jasperconfig')));
$scheduler = $this->getContext()->getModel('JasperScheduler', 'Reporting', array('client' => $factory->getSoapClientForWSDL(Reporting_JasperSoapFactoryModel::SERVICE_SCHEDULER), 'jasperconfig' => $rd->getParameter('jasperconfig'), 'uri' => $rd->getParameter('uri')));
$parameters = $this->getContext()->getModel('JasperParameterStruct', 'Reporting', array('client' => $factory->getSoapClientForWSDL(Reporting_JasperSoapFactoryModel::SERVICE_REPOSITORY), 'jasperconfig' => $rd->getParameter('jasperconfig'), 'uri' => $rd->getParameter('uri'), 'filter' => 'inputControl'));
$stdClass = new stdClass();
if ($rd->hasParameter('job')) {
$stdClass->job = $scheduler->getJobDetail($rd->getParameter('job'));
} else {
$stdClass->job = null;
}
$stdClass->inputControls = $parameters->getJsonStructure();
return json_encode($stdClass);
}
示例7: executeConsole
public function executeConsole(\AgaviRequestDataHolder $request_data)
{
$permissions = $this->getAttribute('permissions');
if (empty($permissions)) {
return "No permissions found!\n";
}
if ($request_data->hasParameter('role')) {
echo PHP_EOL . '# Role "' . $request_data->getParameter('role') . '" has the following permissions:' . PHP_EOL;
} else {
echo PHP_EOL . "All permissions:" . PHP_EOL;
}
foreach ($this->getAttribute('permissions') as $scope => $permission_list) {
echo PHP_EOL . "- Scope: " . $scope . PHP_EOL . PHP_EOL . $permission_list;
}
if ($request_data->hasParameter('role')) {
foreach ($this->getAttribute('parent_permissions') as $parent_role => $permission_map) {
echo PHP_EOL . PHP_EOL . '----------' . PHP_EOL . '# Following permission where inherited from "' . $parent_role . '": ' . PHP_EOL;
foreach ($permission_map as $scope => $permission_list) {
echo PHP_EOL . "- Scope: " . $scope . PHP_EOL . PHP_EOL . $permission_list;
}
}
}
return PHP_EOL;
}
示例8: executeRead
public function executeRead(AgaviRequestDataHolder $request_data)
{
$service_locator = $this->getServiceLocator();
$migration_service = $service_locator->getMigrationService();
$show_only = $request_data->getParameter('only', 'all');
$migration_targets = [];
if (!$request_data->hasParameter('target')) {
foreach ($migration_service->getMigrationTargetMap() as $target_name => $migration_target) {
$migration_targets[$target_name] = ['target' => $migration_target, 'migrations' => $this->getMigrationsForTarget($target_name, $show_only)];
}
} else {
$target_name = $request_data->getParameter('target');
$migration_targets[$target_name] = ['target' => $migration_service->getMigrationTarget($target_name), 'migrations' => $this->getMigrationsForTarget($target_name, $show_only)];
}
$this->setAttribute('only', $show_only);
$this->setAttribute('migration_targets', $migration_targets);
return 'Success';
}