Skip to content

Commit

Permalink
Merge pull request ongr-archive#34 from chyzas/patch_update_TermQuery…
Browse files Browse the repository at this point in the history
…_field_name

TermQuery field name 'is_active' changed to 'active'
  • Loading branch information
saimaz committed Jan 16, 2015
2 parents 0f851de + 1e710b0 commit 1227edf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Document/AbstractCategoryDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract class AbstractCategoryDocument implements DocumentInterface
/**
* @var bool
*
* @ES\Property(type="boolean", name="is_active")
* @ES\Property(type="boolean", name="active")
*/
protected $active;

Expand Down
2 changes: 1 addition & 1 deletion Service/CategoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function buildQuery()
$search = $this->repository->createSearch();
$search->setSize($this->limit);
$search->addSort(new Sort('left', Sort::ORDER_ASC));
$search->addQuery(new TermQuery('is_active', true), 'must');
$search->addQuery(new TermQuery('active', true), 'must');
if (!$this->loadHiddenCategories) {
$search->addQuery(new TermQuery('is_hidden', 0), 'must');
}
Expand Down
60 changes: 30 additions & 30 deletions Tests/Unit/Service/CategoryServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function getDataArray()
'category' => [
[
'_id' => 'cat1',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 2,
'parent_id' => $this->rootId,
Expand All @@ -44,7 +44,7 @@ protected function getDataArray()
],
[
'_id' => 'cat2',
'is_active' => true,
'active' => true,
'sort' => 2,
'left' => 8,
'parent_id' => $this->rootId,
Expand All @@ -53,7 +53,7 @@ protected function getDataArray()
],
[
'_id' => 'cat3',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 1,
'parent_id' => $this->rootId,
Expand All @@ -64,7 +64,7 @@ protected function getDataArray()
],
[
'_id' => 'cat4',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 3,
'parent_id' => $this->rootId,
Expand All @@ -73,7 +73,7 @@ protected function getDataArray()
],
[
'_id' => 'cat41',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 4,
'parent_id' => 'cat4',
Expand All @@ -82,7 +82,7 @@ protected function getDataArray()
],
[
'_id' => 'cat42',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 5,
'parent_id' => 'cat4',
Expand All @@ -91,7 +91,7 @@ protected function getDataArray()
],
[
'_id' => 'cat421',
'is_active' => true,
'active' => true,
'sort' => 2,
'left' => 7,
'parent_id' => 'cat42',
Expand All @@ -100,7 +100,7 @@ protected function getDataArray()
],
[
'_id' => 'cat422',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 6,
'parent_id' => 'cat42',
Expand All @@ -109,7 +109,7 @@ protected function getDataArray()
],
[
'_id' => 'cat5',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 3,
'parent_id' => $this->rootId,
Expand All @@ -118,7 +118,7 @@ protected function getDataArray()
],
[
'_id' => 'cat6',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 9,
'parent_id' => $this->rootId,
Expand Down Expand Up @@ -178,7 +178,7 @@ protected function buildCategory($category)
{
$cat = new Category();
$cat->setId($category['id']);
$cat->setActive($category['is_active']);
$cat->setActive($category['active']);
$cat->setSort($category['sort']);
$cat->setLeft($category['left']);
$cat->setParentId($category['parent_id']);
Expand All @@ -200,7 +200,7 @@ public function treeDataProvider()
$catData = [
[
'id' => 'cat1',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 2,
'parent_id' => $this->rootId,
Expand All @@ -209,7 +209,7 @@ public function treeDataProvider()
],
[
'id' => 'cat2',
'is_active' => true,
'active' => true,
'sort' => 2,
'left' => 8,
'parent_id' => $this->rootId,
Expand All @@ -218,7 +218,7 @@ public function treeDataProvider()
],
[
'id' => 'cat3',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 1,
'parent_id' => $this->rootId,
Expand All @@ -229,7 +229,7 @@ public function treeDataProvider()
],
[
'id' => 'cat4',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 3,
'parent_id' => $this->rootId,
Expand All @@ -238,7 +238,7 @@ public function treeDataProvider()
],
[
'id' => 'cat41',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 4,
'parent_id' => 'cat4',
Expand All @@ -247,7 +247,7 @@ public function treeDataProvider()
],
[
'id' => 'cat42',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 5,
'parent_id' => 'cat4',
Expand All @@ -256,7 +256,7 @@ public function treeDataProvider()
],
[
'id' => 'cat421',
'is_active' => true,
'active' => true,
'sort' => 2,
'left' => 7,
'parent_id' => 'cat42',
Expand All @@ -265,7 +265,7 @@ public function treeDataProvider()
],
[
'id' => 'cat422',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 6,
'parent_id' => 'cat42',
Expand All @@ -274,7 +274,7 @@ public function treeDataProvider()
],
[
'id' => 'cat5',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 3,
'parent_id' => $this->rootId,
Expand All @@ -283,7 +283,7 @@ public function treeDataProvider()
],
[
'id' => 'cat6',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 9,
'parent_id' => $this->rootId,
Expand Down Expand Up @@ -380,7 +380,7 @@ public function getPartialTreeDataProvider()
$cat1 = $this->buildCategory(
[
'id' => 'cat1',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 2,
'parent_id' => $this->rootId,
Expand All @@ -407,7 +407,7 @@ public function getPartialTreeDataProvider()
$cat2 = $this->buildCategory(
[
'id' => 'cat2',
'is_active' => true,
'active' => true,
'sort' => 2,
'left' => 8,
'parent_id' => $this->rootId,
Expand All @@ -418,7 +418,7 @@ public function getPartialTreeDataProvider()
$cat3 = $this->buildCategory(
[
'id' => 'cat3',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 1,
'parent_id' => $this->rootId,
Expand All @@ -431,7 +431,7 @@ public function getPartialTreeDataProvider()
$cat4 = $this->buildCategory(
[
'id' => 'cat4',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 3,
'parent_id' => $this->rootId,
Expand All @@ -442,7 +442,7 @@ public function getPartialTreeDataProvider()
$cat41 = $this->buildCategory(
[
'id' => 'cat41',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 4,
'parent_id' => 'cat4',
Expand All @@ -453,7 +453,7 @@ public function getPartialTreeDataProvider()
$cat42 = $this->buildCategory(
[
'id' => 'cat42',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 5,
'parent_id' => 'cat4',
Expand All @@ -464,7 +464,7 @@ public function getPartialTreeDataProvider()
$cat421 = $this->buildCategory(
[
'id' => 'cat421',
'is_active' => true,
'active' => true,
'sort' => 2,
'left' => 7,
'parent_id' => 'cat42',
Expand Down Expand Up @@ -548,7 +548,7 @@ public function getCategoryDataProvider()
$rawData = [
[
'id' => 'cat1',
'is_active' => true,
'active' => true,
'sort' => 1,
'left' => 2,
'parent_id' => $this->rootId,
Expand All @@ -557,7 +557,7 @@ public function getCategoryDataProvider()
],
[
'id' => 'cat2',
'is_active' => true,
'active' => true,
'sort' => 2,
'left' => 8,
'parent_id' => $this->rootId,
Expand Down

0 comments on commit 1227edf

Please sign in to comment.