本文整理汇总了PHP中QueryObject::getOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryObject::getOrder方法的具体用法?PHP QueryObject::getOrder怎么用?PHP QueryObject::getOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryObject
的用法示例。
在下文中一共展示了QueryObject::getOrder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWithCapabilitiesEnabled
public function getWithCapabilitiesEnabled(QueryObject $query, $offset = 0, $limit = 10)
{
$class = $this->entity_class;
$do = $class::get()->where(" EXISTS( SELECT ID FROM OpenStackImplementationApiCoverage C WHERE ImplementationID = CompanyService.ID) ")->order($query->getOrder())->limit($limit, $offset);
if (is_null($do)) {
return array(array(), 0);
}
$res = $do->toArray();
return array($res, (int) $do->count());
}
示例2: getAll
/**
* @param QueryObject $query
* @param int $offset
* @param int $limit
* @return array
*/
public function getAll(QueryObject $query, $offset = 0, $limit = 10)
{
$filter = (string) $query;
$current_member = Member::currentUser();
$do = null;
if ($current_member && !$current_member->isMarketPlaceSuperAdmin()) {
//if current user is super admin get all
//if not , get just related companies
$companies = $current_member->getManagedMarketPlaceCompaniesByType($this->getMarketPlaceTypeGroup());
if (count($companies)) {
$company_filter = ' CompanyID IN ( ';
foreach ($companies as $company) {
$company_filter .= $company->getIdentifier() . ',';
}
$company_filter = trim($company_filter, ',');
$company_filter .= ' ) ';
if (!empty($filter)) {
$company_filter = ' AND ' . $company_filter;
}
$filter = $filter . $company_filter;
}
}
$inner_joins = $query->getAlias(QueryAlias::INNER);
$left_joins = $query->getAlias(QueryAlias::LEFT);
//build query for data object
$class = $this->entity_class;
$do = $class::get()->where($filter)->sort($query->getOrder())->limit($limit, $offset);
foreach ($inner_joins as $table => $on) {
$do = $do->innerJoin($table, $on);
}
foreach ($left_joins as $table => $on) {
$do = $do->leftJoin($table, $on);
}
if (is_null($do)) {
return array(array(), 0);
}
$res = $do->toArray();
foreach ($res as $entity) {
UnitOfWork::getInstance()->scheduleForUpdate($entity);
}
return array($res, (int) $do->count());
}
示例3: getCollection
public function getCollection(IEntity $owner, $child_class, QueryObject $query, $type)
{
$owner_key = spl_object_hash($owner);
$query_key = md5(sprintf("%s_%s_%s", $query->__toString(), implode(',', $query->getAlias()), implode(',', $query->getOrder())));
$collection_key = md5(sprintf('%s_%s_%s', $owner_key, $child_class, $query_key));
$collections = array();
if ($type == '1-to-many') {
if (array_key_exists($owner_key, $this->loaded_collections_one_2_many_identity_map)) {
$collections = $this->loaded_collections_one_2_many_identity_map[$owner_key];
}
} else {
if (array_key_exists($owner_key, $this->loaded_collections_many_2_many_identity_map)) {
$collections = $this->loaded_collections_many_2_many_identity_map[$owner_key];
}
}
if (array_key_exists($collection_key, $collections)) {
return $collections[$collection_key];
}
return false;
}
示例4: getBy
public function getBy(QueryObject $query)
{
$class = $this->entity_class;
$query->setBaseEntity(new $class());
$filter = (string) $query;
$do = $class::get()->where($filter);
$joins = $query->getAlias();
foreach ($joins as $table => $clause) {
$do = $do->innerJoin($table, $clause);
}
if (count($query->getOrder())) {
$do = $do->sort($query->getOrder());
}
if (is_null($do)) {
return false;
}
$entity = $do->first();
$this->markEntity($entity);
return $entity;
}
示例5: getBy
public function getBy(QueryObject $query)
{
$class = $this->entity_class;
$query->setBaseEntity(new $class());
$filter = (string) $query;
$do = $class::get()->where($filter);
foreach ($query->getAlias(QueryAlias::INNER) as $spec) {
$do = $do->innerJoin($spec->getTable(), $spec->getCondition(), $spec->getAlias());
}
foreach ($query->getAlias(QueryAlias::LEFT) as $spec) {
$do = $do->leftJoin($spec->getTable(), $spec->getCondition(), $spec->getAlias());
}
if (count($query->getOrder())) {
$do = $do->sort($query->getOrder());
}
if (is_null($do)) {
return false;
}
$entity = $do->first();
$this->markEntity($entity);
return $entity;
}
示例6: getBy
public function getBy(QueryObject $query)
{
$class = $this->entity_class;
$query->setBaseEntity(new $class());
$filter = (string) $query;
$do = $class::get()->where($filter);
$joins = $query->getAlias();
foreach ($joins as $table => $clause) {
$do = $do->innerJoin($table, $clause);
}
if (count($query->getOrder())) {
$do = $do->sort($query->getOrder());
}
if (is_null($do)) {
return false;
}
$entity = $do->first();
if (!is_null($entity) && $entity instanceof IEntity) {
UnitOfWork::getInstance()->setToCache($entity);
UnitOfWork::getInstance()->scheduleForUpdate($entity);
}
return $entity;
}