本文整理匯總了PHP中Espo\Core\Utils\Util::toUnderscore方法的典型用法代碼示例。如果您正苦於以下問題:PHP Util::toUnderscore方法的具體用法?PHP Util::toUnderscore怎麽用?PHP Util::toUnderscore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Espo\Core\Utils\Util
的用法示例。
在下文中一共展示了Util::toUnderscore方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run()
{
$uid = $_GET['uid'];
$action = $_GET['action'];
if (empty($uid) || empty($action)) {
throw new BadRequest();
}
if (!in_array($action, array('accept', 'decline', 'tentative'))) {
throw new BadRequest();
}
$uniqueId = $this->getEntityManager()->getRepository('UniqueId')->where(array('name' => $uid))->findOne();
if (!$uniqueId) {
throw new NotFound();
return;
}
$data = $uniqueId->get('data');
$eventType = $data->eventType;
$eventId = $data->eventId;
$inviteeType = $data->inviteeType;
$inviteeId = $data->inviteeId;
$link = $data->link;
if (!empty($eventType) && !empty($eventId) && !empty($inviteeType) && !empty($inviteeId) && !empty($link)) {
$event = $this->getEntityManager()->getEntity($eventType, $eventId);
$invitee = $this->getEntityManager()->getEntity($inviteeType, $inviteeId);
if ($event && $invitee) {
$relDefs = $event->getRelations();
$tableName = Util::toUnderscore($relDefs[$link]['relationName']);
$status = 'None';
if ($action == 'accept') {
$status = 'Accepted';
} else {
if ($action == 'decline') {
$status = 'Declined';
} else {
if ($action == 'tentative') {
$status = 'Tentative';
}
}
}
$pdo = $this->getEntityManager()->getPDO();
$sql = "\n UPDATE `{$tableName}` SET status = '{$status}'\n WHERE " . strtolower($eventType) . "_id = '{$eventId}' AND " . strtolower($inviteeType) . "_id = '{$inviteeId}'\n ";
$sth = $pdo->prepare($sql);
$sth->execute();
$this->getEntityManager()->getRepository('UniqueId')->remove($uniqueId);
echo $status;
return;
}
}
throw new Error();
}