Skip to content

Commit 4c4c62c

Browse files
committed
Merge remote-tracking branch 'firedrakes/MAGETWO-57753-dev' into PRS
2 parents 6cbe387 + fc38dbd commit 4c4c62c

File tree

5 files changed

+85
-1
lines changed

5 files changed

+85
-1
lines changed

app/code/Magento/Catalog/Api/Data/EavAttributeInterface.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,30 @@ public function getIsVisibleInGrid();
139139
*/
140140
public function getIsFilterableInGrid();
141141

142+
/**
143+
* Set is attribute used in grid
144+
*
145+
* @param bool|null $isUsedInGrid
146+
* @return $this
147+
*/
148+
public function setIsUsedInGrid($isUsedInGrid);
149+
150+
/**
151+
* Set is attribute visible in grid
152+
*
153+
* @param bool|null $isVisibleInGrid
154+
* @return $this
155+
*/
156+
public function setIsVisibleInGrid($isVisibleInGrid);
157+
158+
/**
159+
* Set is attribute filterable in grid
160+
*
161+
* @param bool|null $isFilterableInGrid
162+
* @return $this
163+
*/
164+
public function setIsFilterableInGrid($isFilterableInGrid);
165+
142166
/**
143167
* Set whether it is used in search results layered navigation
144168
*

app/code/Magento/Catalog/Model/Category/Attribute.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,31 @@ public function setScope($scope)
361361
return $this;
362362
}
363363
}
364+
365+
/**
366+
* @inheritdoc
367+
*/
368+
public function setIsUsedInGrid($isUsedInGrid)
369+
{
370+
$this->setData(self::IS_USED_IN_GRID, $isUsedInGrid);
371+
return $this;
372+
}
373+
374+
/**
375+
* @inheritdoc
376+
*/
377+
public function setIsVisibleInGrid($isVisibleInGrid)
378+
{
379+
$this->setData(self::IS_VISIBLE_IN_GRID, $isVisibleInGrid);
380+
return $this;
381+
}
382+
383+
/**
384+
* @inheritdoc
385+
*/
386+
public function setIsFilterableInGrid($isFilterableInGrid)
387+
{
388+
$this->setData(self::IS_FILTERABLE_IN_GRID, $isFilterableInGrid);
389+
return $this;
390+
}
364391
}

app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,4 +848,31 @@ public function __wakeup()
848848
$this->_productFlatIndexerHelper = $objectManager->get(\Magento\Catalog\Helper\Product\Flat\Indexer::class);
849849
$this->attrLockValidator = $objectManager->get(LockValidatorInterface::class);
850850
}
851+
852+
/**
853+
* @inheritdoc
854+
*/
855+
public function setIsUsedInGrid($isUsedInGrid)
856+
{
857+
$this->setData(self::IS_USED_IN_GRID, $isUsedInGrid);
858+
return $this;
859+
}
860+
861+
/**
862+
* @inheritdoc
863+
*/
864+
public function setIsVisibleInGrid($isVisibleInGrid)
865+
{
866+
$this->setData(self::IS_VISIBLE_IN_GRID, $isVisibleInGrid);
867+
return $this;
868+
}
869+
870+
/**
871+
* @inheritdoc
872+
*/
873+
public function setIsFilterableInGrid($isFilterableInGrid)
874+
{
875+
$this->setData(self::IS_FILTERABLE_IN_GRID, $isFilterableInGrid);
876+
return $this;
877+
}
851878
}

app/code/Magento/Eav/Api/Data/AttributeInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function setFrontendInput($frontendInput);
9494
/**
9595
* Retrieve entity type id
9696
*
97-
* @return string|null
97+
* @return string
9898
*/
9999
public function getEntityTypeId();
100100

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public function testCreate()
9191
$expectedData = [
9292
'attribute_code' => $attributeCode,
9393
'is_required' => true,
94+
'entity_type_id' => "4",
9495
"frontend_input" => "select",
9596
"is_visible_on_front" => true,
9697
"is_searchable" => true,
@@ -142,6 +143,8 @@ public function testUpdate()
142143
'attribute' => [
143144
'attribute_id' => $attribute['attribute_id'],
144145
'attribute_code' => $attributeCode,
146+
'entity_type_id' => 4,
147+
'is_used_in_grid' => true,
145148
'default_frontend_label' => 'default_label_new',
146149
'frontend_labels' => [
147150
['store_id' => 1, 'label' => 'front_lbl_new'],
@@ -183,6 +186,7 @@ public function testUpdate()
183186
$result = $this->updateAttribute($attributeCode, $attributeData);
184187

185188
$this->assertEquals($attribute['attribute_id'], $result['attribute_id']);
189+
$this->assertEquals(true, $result['is_used_in_grid']);
186190
$this->assertEquals($attributeCode, $result['attribute_code']);
187191
$this->assertEquals('default_label_new', $result['default_frontend_label']);
188192
//New option set as default
@@ -202,6 +206,7 @@ public function testUpdateWithNewOption()
202206
'attribute' => [
203207
'attribute_id' => $attribute['attribute_id'],
204208
'attribute_code' => $attributeCode,
209+
'entity_type_id' => 4,
205210
'is_required' => true,
206211
'frontend_labels' => [
207212
['store_id' => 0, 'label' => 'front_lbl_new'],
@@ -278,6 +283,7 @@ protected function createAttribute($attributeCode)
278283
$attributeData = [
279284
'attribute' => [
280285
'attribute_code' => $attributeCode,
286+
'entity_type_id' => '4',
281287
'frontend_labels' => [
282288
[
283289
'store_id' => 0,

0 commit comments

Comments
 (0)