本文整理汇总了PHP中Action::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::setType方法的具体用法?PHP Action::setType怎么用?PHP Action::setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::setType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testType
public function testType()
{
$action = new Action('add-item', 'http://api.x.io/orders/42/items');
$action->setType('text/plain');
$expectedJson = json_encode(array('name' => 'add-item', 'href' => 'http://api.x.io/orders/42/items', 'method' => 'GET', 'type' => 'text/plain'));
$this->assertJsonStringEqualsJsonString($expectedJson, json_encode($action));
}
示例2: createHistory
function createHistory($o, $h)
{
if ($o instanceof Ticket) {
$history = new TicketHistory();
$history->setTicket($o);
} else {
$history = new IssueHistory();
$history->setIssue($o);
}
if (!empty($h['enteredDate'])) {
$d = DateTime::createFromFormat('U', $h['enteredDate']->sec);
if ($d) {
$history->setEnteredDate($d->format('Y-m-d H:i:s'));
}
}
if (!empty($h['actionDate'])) {
$d = DateTime::createFromFormat('U', $h['actionDate']->sec);
if ($d) {
$history->setActionDate($d->format('Y-m-d H:i:s'));
}
}
if (!empty($h['enteredByPerson'])) {
$id = getPersonIdFromCrosswalk($h['enteredByPerson']['_id']);
if ($id) {
$history->setEnteredByPerson_id($id);
}
}
if (!empty($h['actionPerson'])) {
$id = getPersonIdFromCrosswalk($h['actionPerson']['_id']);
if ($id) {
$history->setActionPerson_id($id);
}
}
if (!empty($h['action'])) {
try {
$action = new Action($h['action']);
} catch (Exception $e) {
$action = new Action();
$action->setName($h['action']);
$action->setDescription($h['action']);
$action->setType('system');
}
$history->setAction($action);
}
if (!empty($h['notes'])) {
$history->setNotes($h['notes']);
}
$history->save();
}
示例3: array
<?php
/**
* @copyright 2011 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
include '../../../configuration.inc';
$resolutions = array('Resolved' => 'This ticket has been taken care of', 'Duplicate' => 'This ticket is a duplicate of another ticket', 'Bogus' => 'This ticket is not actually a problem or has already been taken care of');
foreach ($resolutions as $name => $description) {
$resolution = new Resolution();
$resolution->setName($name);
$resolution->setDescription($description);
$resolution->save();
echo "{$resolution}\n";
}
$actions = array(array('name' => 'open', 'description' => 'Opened by {actionPerson}', 'type' => 'system'), array('name' => 'assignment', 'description' => '{enteredByPerson} assigned this case to {actionPerson}', 'type' => 'system'), array('name' => 'close', 'description' => 'Closed by {actionPerson}', 'type' => 'system'), array('name' => 'referral', 'description' => '{enteredByPerson} referred this case to {actionPerson}', 'type' => 'system'), array('name' => 'Inspection', 'description' => '{actionPerson} inspected this Location', 'type' => 'department'), array('name' => 'Follow up', 'description' => '{actionPerson} followed up on this ticket', 'type' => 'department'));
foreach ($actions as $a) {
$action = new Action();
$action->setName($a['name']);
$action->setDescription($a['description']);
$action->setType($a['type']);
$action->save();
echo "{$action->getName()}\n";
}