Commit be583a7a by Carsten Brandt

fixed problem with sorting by id in elasticsearch

issue #1317
parent 58c02b49
......@@ -116,7 +116,7 @@ class QueryBuilder extends \yii\base\Object
$column = $name;
}
if ($column == ActiveRecord::PRIMARY_KEY_NAME) {
$column = '_id';
$column = '_uid';
}
// allow elasticsearch extended syntax as described in http://www.elasticsearch.org/guide/reference/api/search/sort/
......
......@@ -231,11 +231,11 @@ class ActiveRecordTest extends ElasticSearchTestCase
public function testFindEagerViaRelation()
{
// this test is currently failing randomly because of https://github.com/yiisoft/yii2/issues/1310
$orders = Order::find()->with('items')->orderBy('create_time')->all();
$this->assertEquals(3, count($orders));
$order = $orders[0];
$this->assertEquals(1, $order->id);
$this->assertTrue($order->isRelationPopulated('items'));
$this->assertEquals(2, count($order->items));
$this->assertEquals(1, $order->items[0]->id);
$this->assertEquals(2, $order->items[1]->id);
......
......@@ -295,11 +295,6 @@ trait ActiveRecordTestTrait
public function testFindLimit()
{
if (getenv('TRAVIS') == 'true' && $this instanceof \yiiunit\extensions\elasticsearch\ActiveRecordTest) {
// https://github.com/yiisoft/yii2/issues/1317
$this->markTestSkipped('This test is unreproduceable failing on travis-ci, locally it is passing.');
}
/** @var TestCase|ActiveRecordTestTrait $this */
// all()
$customers = $this->callCustomerFind()->all();
......@@ -420,11 +415,6 @@ trait ActiveRecordTestTrait
public function testFindLazyVia()
{
if (getenv('TRAVIS') == 'true' && $this instanceof \yiiunit\extensions\elasticsearch\ActiveRecordTest) {
// https://github.com/yiisoft/yii2/issues/1317
$this->markTestSkipped('This test is unreproduceable failing on travis-ci, locally it is passing.');
}
/** @var TestCase|ActiveRecordTestTrait $this */
/** @var Order $order */
$order = $this->callOrderFind(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment