diff --git a/Document/AbstractCategoryDocument.php b/Document/AbstractCategoryDocument.php index fb02df4..fe0455f 100755 --- a/Document/AbstractCategoryDocument.php +++ b/Document/AbstractCategoryDocument.php @@ -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; diff --git a/Service/CategoryService.php b/Service/CategoryService.php index c957828..b686eb5 100755 --- a/Service/CategoryService.php +++ b/Service/CategoryService.php @@ -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'); } diff --git a/Tests/Unit/Service/CategoryServiceTest.php b/Tests/Unit/Service/CategoryServiceTest.php index 3154852..c0dd9ac 100644 --- a/Tests/Unit/Service/CategoryServiceTest.php +++ b/Tests/Unit/Service/CategoryServiceTest.php @@ -35,7 +35,7 @@ protected function getDataArray() 'category' => [ [ '_id' => 'cat1', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 2, 'parent_id' => $this->rootId, @@ -44,7 +44,7 @@ protected function getDataArray() ], [ '_id' => 'cat2', - 'is_active' => true, + 'active' => true, 'sort' => 2, 'left' => 8, 'parent_id' => $this->rootId, @@ -53,7 +53,7 @@ protected function getDataArray() ], [ '_id' => 'cat3', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 1, 'parent_id' => $this->rootId, @@ -64,7 +64,7 @@ protected function getDataArray() ], [ '_id' => 'cat4', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 3, 'parent_id' => $this->rootId, @@ -73,7 +73,7 @@ protected function getDataArray() ], [ '_id' => 'cat41', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 4, 'parent_id' => 'cat4', @@ -82,7 +82,7 @@ protected function getDataArray() ], [ '_id' => 'cat42', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 5, 'parent_id' => 'cat4', @@ -91,7 +91,7 @@ protected function getDataArray() ], [ '_id' => 'cat421', - 'is_active' => true, + 'active' => true, 'sort' => 2, 'left' => 7, 'parent_id' => 'cat42', @@ -100,7 +100,7 @@ protected function getDataArray() ], [ '_id' => 'cat422', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 6, 'parent_id' => 'cat42', @@ -109,7 +109,7 @@ protected function getDataArray() ], [ '_id' => 'cat5', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 3, 'parent_id' => $this->rootId, @@ -118,7 +118,7 @@ protected function getDataArray() ], [ '_id' => 'cat6', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 9, 'parent_id' => $this->rootId, @@ -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']); @@ -200,7 +200,7 @@ public function treeDataProvider() $catData = [ [ 'id' => 'cat1', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 2, 'parent_id' => $this->rootId, @@ -209,7 +209,7 @@ public function treeDataProvider() ], [ 'id' => 'cat2', - 'is_active' => true, + 'active' => true, 'sort' => 2, 'left' => 8, 'parent_id' => $this->rootId, @@ -218,7 +218,7 @@ public function treeDataProvider() ], [ 'id' => 'cat3', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 1, 'parent_id' => $this->rootId, @@ -229,7 +229,7 @@ public function treeDataProvider() ], [ 'id' => 'cat4', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 3, 'parent_id' => $this->rootId, @@ -238,7 +238,7 @@ public function treeDataProvider() ], [ 'id' => 'cat41', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 4, 'parent_id' => 'cat4', @@ -247,7 +247,7 @@ public function treeDataProvider() ], [ 'id' => 'cat42', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 5, 'parent_id' => 'cat4', @@ -256,7 +256,7 @@ public function treeDataProvider() ], [ 'id' => 'cat421', - 'is_active' => true, + 'active' => true, 'sort' => 2, 'left' => 7, 'parent_id' => 'cat42', @@ -265,7 +265,7 @@ public function treeDataProvider() ], [ 'id' => 'cat422', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 6, 'parent_id' => 'cat42', @@ -274,7 +274,7 @@ public function treeDataProvider() ], [ 'id' => 'cat5', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 3, 'parent_id' => $this->rootId, @@ -283,7 +283,7 @@ public function treeDataProvider() ], [ 'id' => 'cat6', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 9, 'parent_id' => $this->rootId, @@ -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, @@ -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, @@ -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, @@ -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, @@ -442,7 +442,7 @@ public function getPartialTreeDataProvider() $cat41 = $this->buildCategory( [ 'id' => 'cat41', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 4, 'parent_id' => 'cat4', @@ -453,7 +453,7 @@ public function getPartialTreeDataProvider() $cat42 = $this->buildCategory( [ 'id' => 'cat42', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 5, 'parent_id' => 'cat4', @@ -464,7 +464,7 @@ public function getPartialTreeDataProvider() $cat421 = $this->buildCategory( [ 'id' => 'cat421', - 'is_active' => true, + 'active' => true, 'sort' => 2, 'left' => 7, 'parent_id' => 'cat42', @@ -548,7 +548,7 @@ public function getCategoryDataProvider() $rawData = [ [ 'id' => 'cat1', - 'is_active' => true, + 'active' => true, 'sort' => 1, 'left' => 2, 'parent_id' => $this->rootId, @@ -557,7 +557,7 @@ public function getCategoryDataProvider() ], [ 'id' => 'cat2', - 'is_active' => true, + 'active' => true, 'sort' => 2, 'left' => 8, 'parent_id' => $this->rootId,