本文整理汇总了PHP中DepartmentPeer::doCount方法的典型用法代码示例。如果您正苦于以下问题:PHP DepartmentPeer::doCount方法的具体用法?PHP DepartmentPeer::doCount怎么用?PHP DepartmentPeer::doCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DepartmentPeer
的用法示例。
在下文中一共展示了DepartmentPeer::doCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOwnersByType
public function getOwnersByType($data)
{
$this->setResponseType('json');
$result = new stdclass();
$result->status = 'OK';
try {
switch ($data->type) {
case 'EVERYBODY':
$result->total = 0;
$result->owners = array();
break;
case 'USER':
require_once 'classes/model/Users.php';
$users = array();
$usersInstance = new Users();
$allUsers = $usersInstance->getAll();
foreach ($allUsers->data as $user) {
$users[] = array('OWNER_UID' => $user['USR_UID'], 'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']);
}
usort($users, function ($str1, $str2) {
return strcmp(strtolower($str1["OWNER_NAME"]), strtolower($str2["OWNER_NAME"]));
});
$result->total = $allUsers->totalCount;
$result->owners = $users;
break;
case 'DEPARTMENT':
require_once 'classes/model/Department.php';
require_once 'classes/model/Content.php';
$departments = array();
//SELECT
$criteria = new Criteria('workflow');
$criteria->setDistinct();
$criteria->addSelectColumn(DepartmentPeer::DEP_UID);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
//FROM
$conditions = array();
$conditions[] = array(DepartmentPeer::DEP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
//WHERE
$criteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
//ORDER BY
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
$dataset = DepartmentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$departments[] = array('OWNER_UID' => $row['DEP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$dataset->next();
}
$result->total = DepartmentPeer::doCount($criteria);
$result->owners = $departments;
break;
case 'GROUP':
require_once 'classes/model/Groupwf.php';
require_once 'classes/model/Content.php';
$groups = array();
//SELECT
$criteria = new Criteria('workflow');
$criteria->setDistinct();
$criteria->addSelectColumn(GroupwfPeer::GRP_UID);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
//FROM
$conditions = array();
$conditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID);
$conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter());
$conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter());
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
//WHERE
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
//ORDER BY
$criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
$dataset = GroupwfPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$groups[] = array('OWNER_UID' => $row['GRP_UID'], 'OWNER_NAME' => $row['CON_VALUE']);
$dataset->next();
}
$result->total = GroupwfPeer::doCount($criteria);
$result->owners = $groups;
break;
}
} catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
return $result;
}
示例2: countDepartmentsRelatedByParent
public function countDepartmentsRelatedByParent($criteria = null, $distinct = false, $con = null)
{
include_once 'lib/model/om/BaseDepartmentPeer.php';
if ($criteria === null) {
$criteria = new Criteria();
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
$criteria->add(DepartmentPeer::PARENT, $this->getId());
return DepartmentPeer::doCount($criteria, $distinct, $con);
}