Skip to content

Commit 84ec0ac

Browse files
committed
MAGETWO-32583: [Dev] Magic __call method usages in template engine
- Merged remote-tracking branch 'mainline/develop' into BUGS Conflicts: app/code/Magento/Search/view/frontend/templates/search_data.phtml dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
2 parents d83fcc1 + f94717b commit 84ec0ac

File tree

198 files changed

+12128
-5760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+12128
-5760
lines changed

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 193 additions & 130 deletions
Large diffs are not rendered by default.

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 334 additions & 179 deletions
Large diffs are not rendered by default.

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ interface EavAttributeInterface extends \Magento\Eav\Api\Data\AttributeInterface
2222

2323
const APPLY_TO = 'apply_to';
2424

25-
const IS_CONFIGURABLE = 'is_configurable';
26-
2725
const IS_SEARCHABLE = 'is_searchable';
2826

2927
const IS_VISIBLE_IN_ADVANCED_SEARCH = 'is_visible_in_advanced_search';
@@ -95,12 +93,6 @@ public function getPosition();
9593
*/
9694
public function getApplyTo();
9795

98-
/**
99-
* Whether the attribute can be used for configurable products
100-
*
101-
* @return string|null
102-
*/
103-
public function getIsConfigurable();
10496
/**
10597
* Whether the attribute can be used in Quick Search
10698
*

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,6 @@ public function setApplyTo($applyTo)
118118
return $this;
119119
}
120120

121-
/**
122-
* @param string|null $isConfigurable
123-
* @return $this
124-
*/
125-
public function setIsConfigurable($isConfigurable)
126-
{
127-
$this->_set('is_configurable', $isConfigurable);
128-
return $this;
129-
}
130-
131121
/**
132122
* @param string|null $isSearchable
133123
* @return $this

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,6 @@ public function getIsSearchable()
8383
return $this->getData(self::IS_SEARCHABLE);
8484
}
8585

86-
/**
87-
* {@inheritdoc}
88-
*/
89-
public function getIsConfigurable()
90-
{
91-
return $this->getData(self::IS_CONFIGURABLE);
92-
}
93-
9486
/**
9587
* {@inheritdoc}
9688
*/

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

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ public function deleteChildren(\Magento\Framework\Object $object)
223223
*
224224
* @param \Magento\Framework\Object $object
225225
* @return $this
226+
* @SuppressWarnings(PHPMD.NPathComplexity)
227+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
226228
*/
227229
protected function _beforeSave(\Magento\Framework\Object $object)
228230
{
@@ -231,21 +233,27 @@ protected function _beforeSave(\Magento\Framework\Object $object)
231233
if (!$object->getChildrenCount()) {
232234
$object->setChildrenCount(0);
233235
}
234-
if ($object->getLevel() === null) {
235-
$object->setLevel(1);
236-
}
237236

238-
if (!$object->getId()) {
239-
$object->setPosition($this->_getMaxPosition($object->getPath()) + 1);
237+
if ($object->isObjectNew()) {
238+
if (is_null($object->getPosition())) {
239+
$object->setPosition($this->_getMaxPosition($object->getPath()) + 1);
240+
}
240241
$path = explode('/', $object->getPath());
241-
$level = count($path);
242-
$object->setLevel($level);
243-
if ($level) {
242+
$level = count($path) - ($object->getId() ? 1 : 0);
243+
$toUpdateChild = array_diff($path, [$object->getId()]);
244+
245+
if (!$object->hasPosition()) {
246+
$object->setPosition($this->_getMaxPosition(implode('/', $toUpdateChild)) + 1);
247+
}
248+
if (!$object->hasLevel()) {
249+
$object->setLevel($level);
250+
}
251+
if (!$object->hasParentId() && $level) {
244252
$object->setParentId($path[$level - 1]);
245253
}
246-
$object->setPath($object->getPath() . '/');
247-
248-
$toUpdateChild = explode('/', $object->getPath());
254+
if (!$object->getId()) {
255+
$object->setPath($object->getPath() . '/');
256+
}
249257

250258
$this->_getWriteAdapter()->update(
251259
$this->getEntityTable(),

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,6 @@ public function getPosition()
544544
return $this->getData(self::POSITION);
545545
}
546546

547-
/**
548-
* {@inheritdoc}
549-
*/
550-
public function getIsConfigurable()
551-
{
552-
return $this->getData(self::IS_CONFIGURABLE);
553-
}
554-
555547
/**
556548
* {@inheritdoc}
557549
*/

app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
->load(1)
1515
->setId(1)
1616
->setStoreId(0)
17-
->setPath(1)
17+
->setPath('1')
1818
->setLevel(0)
1919
->setPosition(0)
2020
->setChildrenCount(0)
@@ -26,11 +26,12 @@
2626

2727
$installer->createCategory()
2828
->setStoreId(0)
29+
->setPath('1')
2930
->setName('Default Category')
3031
->setDisplayMode('PRODUCTS')
3132
->setAttributeSetId($category->getDefaultAttributeSetId())
3233
->setIsActive(1)
33-
->setPath('1')
34+
->setLevel(1)
3435
->setInitialSetupFlag(true)
3536
->save();
3637

0 commit comments

Comments
 (0)