当前位置: 首页>>代码示例>>PHP>>正文


PHP Query::orderBy方法代码示例

本文整理汇总了PHP中Query::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::orderBy方法的具体用法?PHP Query::orderBy怎么用?PHP Query::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


在下文中一共展示了Query::orderBy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testOrderBy

 /**
  * @covers flowcode\ceibo\domain\Query::orderBy
  */
 public function testOrderBy()
 {
     $this->object->orderBy("name");
     $this->object->orderBy("name", "DESC");
     $stmt = $this->object->buildStatement();
     $this->assertEquals("SELECT * FROM ovni ORDER BY name ASC, name DESC", $stmt);
 }
开发者ID:flowcode,项目名称:ceibo,代码行数:10,代码来源:QueryTest.php

示例2: index

 public function index()
 {
     $query = new Query();
     $query->orderBy('id', 'DESC');
     $query->limit(4);
     $posts = $query->find('Posts');
     $this->render('index.html.twig', array('posts' => $posts));
 }
开发者ID:medrupaloscil,项目名称:frameSup,代码行数:8,代码来源:TestController.php

示例3: testOrdering

 public function testOrdering()
 {
     $path = __DIR__ . '/fixtures/datastore/querytest';
     $config = new Config($path . '/');
     $repo = new Repository('countries', $config);
     $query = new Query($repo);
     $query->orderBy('capital DESC');
     $result = $query->execute();
     $this->assertEquals('Croatia', $result->first()->id);
     $this->assertEquals('Heard Island and McDonald Islands', $result[$result->count() - 1]->id);
 }
开发者ID:gekt,项目名称:www,代码行数:11,代码来源:QueryTest.php

示例4: scopePublicLatestReleases

 /**
  * Get public latest releases with artist name
  * 
  * @param  Query $query
  * @return Query
  */
 public function scopePublicLatestReleases($query)
 {
     return $query->orderBy('released_at', 'desc')->join('artists', 'artists.id', '=', 'releases.artist_id')->select(['releases.title', 'releases.permalink', 'releases.coverart_thumbnail', 'releases.coverart_alt', 'releases.genre', DB::raw('artists.name as artist_name')])->where('releases.active', true);
 }
开发者ID:sonusbeat,项目名称:soundcore,代码行数:10,代码来源:Release.php

示例5: scopeLatest

 /**
  * Se obtienen todos los posts con su categoria y seccion activos
  * 
  * @param  Query $query
  * @return Query
  */
 public function scopeLatest($query)
 {
     return $query->orderBy('posts.created_at', 'desc')->join('categories', 'categories.id', '=', 'posts.category_id')->select(['posts.id', 'posts.category_id', 'posts.title', 'posts.permalink', 'posts.active', DB::raw('categories.name as category_name'), DB::raw('categories.permalink as category_permalink')]);
 }
开发者ID:sonusbeat,项目名称:soundcore,代码行数:10,代码来源:Post.php

示例6: Query

<?php

require_once 'autoloader.php';
$query = new Query();
$query->orderBy('id', 'DESC');
$query->limit(2, 4);
$user = $query->isEntity('Users');
var_dump($user);
$user = new Users();
$user->setPseudo('Luke Skywalker');
$user->setAge('26');
$user->setPassword('LoveMySister');
$user->save();
开发者ID:medrupaloscil,项目名称:SupOrm,代码行数:13,代码来源:index.php

示例7: _sorterQueryObject

 /**
  * Aplica ordenação em objetos Query.
  *
  * @param Query $query
  * @return Query
  * */
 private function _sorterQueryObject($query)
 {
     foreach ($this->_orderByList as $colName => $order) {
         $query->orderBy(array($colName => $order));
     }
     return $query;
 }
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:13,代码来源:Persist.php

示例8: testSelectDistinctStatement_Order_By_Array

 public function testSelectDistinctStatement_Order_By_Array()
 {
     $query = new Query("SELECT DISTINCT id, description FROM `test`");
     $query->orderBy(array("name", "description", "checksum"));
     $this->assertEquals("SELECT DISTINCT id, description FROM `test` ORDER BY `name`, `description`, `checksum`", (string) $query);
 }
开发者ID:jasny,项目名称:dbquery-mysql,代码行数:6,代码来源:QueryTest.php


注:本文中的Query::orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。