本文整理汇总了PHP中Api::_方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::_方法的具体用法?PHP Api::_怎么用?PHP Api::_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::_方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assert
public function assert(Rbac $rbac)
{
$friendModel = Api::_()->getModel('User\\Model\\Friend');
$friendDb = $friendModel->getItem()->getDataClass();
$res = $friendDb->where(array('user_id' => $this->user['id'], 'friend_id' => $this->visitor['id'], 'relationshipStatus' => 'blocked'))->find('one');
return true;
}
示例2: setParameters
public function setParameters(Parameters $params)
{
if ($params->page) {
$this->enableCount();
$this->page($params->page);
}
if ($params->noLimit) {
$this->disableLimit();
}
if ($params->order == 'eventcountdesc' || $params->order == 'eventcountasc') {
$eventTagTable = Api::_()->getDbTable('Event\\DbTable\\TagsEvents');
$eventTagTableName = $eventTagTable->initTableName()->getTable();
$this->join($eventTagTableName, "id = {$eventTagTableName}.tag_id");
$this->columns(array('*', 'EventCount' => new Expression("count(event_id)")));
$this->group('tag_id');
}
$orders = array('idasc' => 'id ASC', 'iddesc' => 'id DESC', 'nameasc' => 'tagName ASC', 'namedesc' => 'tagName DESC');
if ($params->order) {
$order = $orders[$params->order];
if ($order) {
$this->order($order);
}
}
return $this;
}
示例3: setParameters
public function setParameters(Parameters $params)
{
if ($params->page) {
$this->enableCount();
$this->page($params->page);
}
if ($params->event_id) {
$this->where(array('event_id' => $params->event_id));
}
if ($params->user_id) {
$this->where(array('user_id' => $params->user_id));
}
if ($params->requestStatus) {
$this->where(array('requestStatus' => $params->requestStatus));
}
if ($params->rows) {
$this->limit((int) $params->rows);
}
if ($params->eventStatus) {
$eventDb = Api::_()->getDbTable('Event\\DbTable\\Events');
$eventTabName = $eventDb->initTableName()->table;
$this->join($eventTabName, "{$this->table}.event_id = {$eventTabName}.id", array('*'), 'inner');
$this->where(array("{$eventTabName}.eventStatus" => $params->eventStatus));
}
if ($params->order == 'eventcount') {
/*
$this->from(array('b' => $this->table));
$distinct = new \Zend\Db\Sql\Expression("DISTINCT {$this->table}.user_id");
$count = new \Zend\Db\Sql\Expression("(SELECT COUNT(*) AS {$this->table}.EventCount FROM b WHERE b.user_id = {$this->table}.user_id)");
$this->columns(array($distinct, $count));
*/
}
if ($params->noLimit) {
$this->disableLimit();
}
$orders = array('eventcount' => 'EventCount DESC', 'timeasc' => 'requestTime ASC', 'timedesc' => 'requestTime DESC');
if ($params->order) {
$order = $orders[$params->order];
if ($order) {
$this->order($order);
}
}
return $this;
}