Skip to content

Commit 6352f8f

Browse files
author
Momotenko,Natalia(nmomotenko)
committed
Merge pull request #524 from magento-firedrakes/MAGETWO-50676
[Firedrakes] MAGETWO-50676 EntityManager introduction
2 parents a89acbb + 7452b6e commit 6352f8f

File tree

276 files changed

+3014
-4264
lines changed

Some content is hidden

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

276 files changed

+3014
-4264
lines changed

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,14 +985,14 @@ private function invokeMethod($object, $method, $args = [])
985985
private function getAdvancedPricingMock($methods = [])
986986
{
987987
$metadataPoolMock = $this->getMock(
988-
\Magento\Framework\Model\Entity\MetadataPool::class,
988+
\Magento\Framework\EntityManager\MetadataPool::class,
989989
[],
990990
[],
991991
'',
992992
false
993993
);
994994
$metadataMock = $this->getMock(
995-
\Magento\Framework\Model\Entity\EntityMetadata::class,
995+
\Magento\Framework\EntityManager\EntityMetadata::class,
996996
[],
997997
[],
998998
'',

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\App\ObjectManager;
1212
use Magento\Framework\Exception\CouldNotSaveException;
1313
use Magento\Framework\Exception\InputException;
14-
use Magento\Framework\Model\Entity\MetadataPool;
14+
use Magento\Framework\EntityManager\MetadataPool;
1515

1616
/**
1717
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)

app/code/Magento/Bundle/Model/OptionRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\Exception\CouldNotSaveException;
1212
use Magento\Framework\Exception\InputException;
1313
use Magento\Framework\Exception\NoSuchEntityException;
14-
use Magento\Framework\Model\Entity\MetadataPool;
14+
use Magento\Framework\EntityManager\MetadataPool;
1515

1616
/**
1717
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -64,7 +64,7 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt
6464
protected $dataObjectHelper;
6565

6666
/**
67-
* @var \Magento\Framework\Model\Entity\MetadataPool
67+
* @var \Magento\Framework\EntityManager\MetadataPool
6868
*/
6969
private $metadataPool;
7070

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
namespace Magento\Bundle\Model\Product;
77

88
use Magento\Bundle\Api\ProductOptionRepositoryInterface as OptionRepository;
9+
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
910

1011
/**
1112
* Class ReadHandler
1213
*/
13-
class ReadHandler
14+
class ReadHandler implements ExtensionInterface
1415
{
1516
/**
1617
* @var OptionRepository
@@ -30,10 +31,11 @@ public function __construct(OptionRepository $optionRepository)
3031
/**
3132
* @param string $entityType
3233
* @param object $entity
34+
* @param array $arguments
3335
* @return \Magento\Catalog\Api\Data\ProductInterface
3436
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3537
*/
36-
public function execute($entityType, $entity)
38+
public function execute($entityType, $entity, $arguments = [])
3739
{
3840
/** @var $entity \Magento\Catalog\Api\Data\ProductInterface */
3941
if ($entity->getTypeId() != \Magento\Bundle\Model\Product\Type::TYPE_CODE) {

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
namespace Magento\Bundle\Model\Product;
88

99
use Magento\Bundle\Api\ProductOptionRepositoryInterface as OptionRepository;
10-
use Magento\Framework\Model\Entity\MetadataPool;
11-
use Magento\Framework\Model\ResourceModel\Db\ProcessEntityRelationInterface;
10+
use Magento\Framework\EntityManager\MetadataPool;
1211
use Magento\Bundle\Api\ProductLinkManagementInterface;
12+
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
1313

1414
/**
1515
* Class SaveHandler
1616
*/
17-
class SaveHandler
17+
class SaveHandler implements ExtensionInterface
1818
{
1919
/**
2020
* @var MetadataPool
@@ -49,10 +49,11 @@ public function __construct(
4949
/**
5050
* @param string $entityType
5151
* @param object $entity
52-
* @return object
52+
* @param array $arguments
53+
* @return \Magento\Catalog\Api\Data\ProductInterface|object
5354
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5455
*/
55-
public function execute($entityType, $entity)
56+
public function execute($entityType, $entity, $arguments = [])
5657
{
5758
$bundleProductOptions = $entity->getExtensionAttributes()->getBundleProductOptions();
5859
if ($entity->getTypeId() !== 'bundle' || empty($bundleProductOptions)) {

app/code/Magento/Bundle/Model/ResourceModel/Option.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Bundle\Model\ResourceModel;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9-
use Magento\Framework\Model\Entity\MetadataPool;
9+
use Magento\Framework\EntityManager\MetadataPool;
1010
use Magento\Framework\App\ObjectManager;
1111

1212
/**

app/code/Magento/Bundle/Model/ResourceModel/Selection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Bundle\Model\ResourceModel;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9-
use Magento\Framework\Model\Entity\MetadataPool;
9+
use Magento\Framework\EntityManager\MetadataPool;
1010
use Magento\Framework\Model\ResourceModel\Db\Context;
1111

1212
/**

app/code/Magento/Bundle/Setup/Recurring.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Framework\Setup\InstallSchemaInterface;
1010
use Magento\Framework\Setup\ModuleContextInterface;
1111
use Magento\Framework\Setup\SchemaSetupInterface;
12-
use Magento\Framework\Model\Entity\MetadataPool;
12+
use Magento\Framework\EntityManager\MetadataPool;
1313
use Magento\Catalog\Api\Data\ProductInterface;
1414

1515
/**

app/code/Magento/Bundle/Test/Unit/Model/LinkManagementTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ class LinkManagementTest extends \PHPUnit_Framework_TestCase
101101
protected $dataObjectHelperMock;
102102

103103
/**
104-
* @var \Magento\Framework\Model\Entity\MetadataPool|\PHPUnit_Framework_MockObject_MockObject
104+
* @var \Magento\Framework\EntityManager\MetadataPool|\PHPUnit_Framework_MockObject_MockObject
105105
*/
106106
protected $metadataPoolMock;
107107

108108
/**
109-
* @var \Magento\Framework\Model\Entity\EntityMetadata|\PHPUnit_Framework_MockObject_MockObject
109+
* @var \Magento\Framework\EntityManager\EntityMetadata|\PHPUnit_Framework_MockObject_MockObject
110110
*/
111111
protected $metadataMock;
112112

@@ -159,10 +159,10 @@ protected function setUp()
159159
'\Magento\Bundle\Model\ResourceModel\Option\CollectionFactory', ['create'], [], '', false
160160
);
161161
$this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface', [], [], '', false);
162-
$this->metadataPoolMock = $this->getMockBuilder('\Magento\Framework\Model\Entity\MetadataPool')
162+
$this->metadataPoolMock = $this->getMockBuilder('\Magento\Framework\EntityManager\MetadataPool')
163163
->disableOriginalConstructor()
164164
->getMock();
165-
$this->metadataMock = $this->getMockBuilder('\Magento\Framework\Model\Entity\EntityMetadata')
165+
$this->metadataMock = $this->getMockBuilder('\Magento\Framework\EntityManager\EntityMetadata')
166166
->disableOriginalConstructor()
167167
->getMock();
168168
$this->metadataPoolMock->expects($this->any())->method('getMetadata')

app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected function setUp()
9797
$this->linkManagementMock = $this->getMock('\Magento\Bundle\Api\ProductLinkManagementInterface');
9898
$this->optionListMock = $this->getMock('\Magento\Bundle\Model\Product\OptionList', [], [], '', false);
9999
$this->linkListMock = $this->getMock('\Magento\Bundle\Model\Product\LinksList', [], [], '', false);
100-
$this->metadataPoolMock = $this->getMock('Magento\Framework\Model\Entity\MetadataPool', [], [], '', false);
100+
$this->metadataPoolMock = $this->getMock('Magento\Framework\EntityManager\MetadataPool', [], [], '', false);
101101

102102
$this->model = new OptionRepository(
103103
$this->productRepositoryMock,
@@ -295,7 +295,7 @@ public function testSaveExistingOption()
295295
false
296296
);
297297
$metadataMock = $this->getMock(
298-
'Magento\Framework\Model\Entity\EntityMetadata',
298+
'Magento\Framework\EntityManager\EntityMetadata',
299299
[],
300300
[],
301301
'',
@@ -352,7 +352,7 @@ public function testSaveNewOption()
352352
false
353353
);
354354
$metadataMock = $this->getMock(
355-
'Magento\Framework\Model\Entity\EntityMetadata',
355+
'Magento\Framework\EntityManager\EntityMetadata',
356356
[],
357357
[],
358358
'',
@@ -416,7 +416,7 @@ public function testSaveCanNotSave()
416416
false
417417
);
418418
$metadataMock = $this->getMock(
419-
'Magento\Framework\Model\Entity\EntityMetadata',
419+
'Magento\Framework\EntityManager\EntityMetadata',
420420
[],
421421
[],
422422
'',

app/code/Magento/Bundle/etc/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080
<type name="Magento\Catalog\Model\Product">
8181
<plugin name="bundle" type="Magento\Bundle\Model\Plugin\Product" sortOrder="100" />
8282
</type>
83-
<type name="Magento\Framework\Model\ResourceModel\Db\Relation\ActionPool">
83+
<type name="Magento\Framework\EntityManager\Operation\ExtensionPool">
8484
<arguments>
85-
<argument name="relationActions" xsi:type="array">
85+
<argument name="extensionActions" xsi:type="array">
8686
<item name="Magento\Catalog\Api\Data\ProductInterface" xsi:type="array">
8787
<item name="create" xsi:type="array">
8888
<item name="create_bundle_options" xsi:type="string">Magento\Bundle\Model\Product\SaveHandler</item>

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ protected function setUp()
202202
]
203203
);
204204

205-
$metadataMock = $this->getMock(\Magento\Framework\Model\Entity\EntityMetadata::class, [], [], '', false);
205+
$metadataMock = $this->getMock(\Magento\Framework\EntityManager\EntityMetadata::class, [], [], '', false);
206206
$metadataMock->expects($this->any())
207207
->method('getLinkField')
208208
->willReturn('entity_id');
209-
$metadataPoolMock = $this->getMock(\Magento\Framework\Model\Entity\MetadataPool::class, [], [], '', false);
209+
$metadataPoolMock = $this->getMock(\Magento\Framework\EntityManager\MetadataPool::class, [], [], '', false);
210210
$metadataPoolMock->expects($this->any())
211211
->method('getMetadata')
212212
->with(\Magento\Catalog\Api\Data\ProductInterface::class)

app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ProductAttributesCleanUp extends \Symfony\Component\Console\Command\Comman
3737
protected $appState;
3838

3939
/**
40-
* @var \Magento\Framework\Model\Entity\EntityMetadata
40+
* @var \Magento\Framework\EntityManager\EntityMetadata
4141
*/
4242
protected $metadata;
4343

@@ -46,14 +46,14 @@ class ProductAttributesCleanUp extends \Symfony\Component\Console\Command\Comman
4646
* @param \Magento\Catalog\Model\ResourceModel\Attribute $attributeResource
4747
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
4848
* @param \Magento\Framework\App\State $appState
49-
* @param \Magento\Framework\Model\Entity\MetadataPool $metadataPool
49+
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
5050
*/
5151
public function __construct(
5252
\Magento\Catalog\Api\ProductAttributeRepositoryInterface $productAttributeRepository,
5353
\Magento\Catalog\Model\ResourceModel\Attribute $attributeResource,
5454
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
5555
\Magento\Framework\App\State $appState,
56-
\Magento\Framework\Model\Entity\MetadataPool $metadataPool
56+
\Magento\Framework\EntityManager\MetadataPool $metadataPool
5757
) {
5858
$this->productAttributeRepository = $productAttributeRepository;
5959
$this->searchCriteriaBuilder = $searchCriteriaBuilder;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Catalog\Model\Attribute;
88

9-
use Magento\Framework\Model\Entity\MetadataPool;
9+
use Magento\Framework\EntityManager\MetadataPool;
1010
use Magento\Eav\Api\AttributeRepositoryInterface as AttributeRepository;
1111
use Magento\Framework\Api\SearchCriteriaBuilder;
1212
use Magento\Framework\Api\FilterBuilder;

app/code/Magento/Catalog/Model/CatalogRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Magento\Catalog\Model;
88

99
use Magento\Framework\Model\EntityRegistry;
10-
use Magento\Framework\Model\EntityManager;
10+
use Magento\Framework\EntityManager\EntityManager;
1111

1212
/**
1313
* Class CatalogRegistry

app/code/Magento/Catalog/Model/CategoryRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInter
3838
protected $categoryResource;
3939

4040
/**
41-
* @var \Magento\Framework\Model\Entity\MetadataPool
41+
* @var \Magento\Framework\EntityManager\MetadataPool
4242
*/
4343
protected $metadataPool;
4444

@@ -215,13 +215,13 @@ private function getExtensibleDataObjectConverter()
215215
}
216216

217217
/**
218-
* @return \Magento\Framework\Model\Entity\MetadataPool
218+
* @return \Magento\Framework\EntityManager\MetadataPool
219219
*/
220220
private function getMetadataPool()
221221
{
222222
if (null === $this->metadataPool) {
223223
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
224-
->get('Magento\Framework\Model\Entity\MetadataPool');
224+
->get('Magento\Framework\EntityManager\MetadataPool');
225225
}
226226
return $this->metadataPool;
227227
}

app/code/Magento/Catalog/Model/Indexer/Category/Flat/AbstractAction.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Magento\Catalog\Model\Indexer\Category\Flat;
1010

1111
use Magento\Framework\App\ResourceConnection;
12-
use Magento\Framework\Model\Entity\MetadataPool;
12+
use Magento\Framework\EntityManager\MetadataPool;
1313

1414
class AbstractAction
1515
{
@@ -55,7 +55,7 @@ class AbstractAction
5555
protected $connection;
5656

5757
/**
58-
* @var \Magento\Framework\Model\Entity\EntityMetadata
58+
* @var \Magento\Framework\EntityManager\EntityMetadata
5959
*/
6060
protected $categoryMetadata;
6161

@@ -467,13 +467,13 @@ protected function getTableName($name)
467467
}
468468

469469
/**
470-
* @return \Magento\Framework\Model\Entity\EntityMetadata
470+
* @return \Magento\Framework\EntityManager\EntityMetadata
471471
*/
472472
private function getCategoryMetadata()
473473
{
474474
if (null === $this->categoryMetadata) {
475475
$metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
476-
->get('Magento\Framework\Model\Entity\MetadataPool');
476+
->get('Magento\Framework\EntityManager\MetadataPool');
477477
$this->categoryMetadata = $metadataPool->getMetadata(\Magento\Catalog\Api\Data\CategoryInterface::class);
478478
}
479479
return $this->categoryMetadata;

app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Magento\Catalog\Model\Indexer\Category\Product;
1010

1111
use Magento\Framework\App\ResourceConnection;
12-
use Magento\Framework\Model\Entity\MetadataPool;
12+
use Magento\Framework\EntityManager\MetadataPool;
1313

1414
/**
1515
* Class AbstractAction
@@ -628,13 +628,13 @@ protected function reindexRootCategory(\Magento\Store\Model\Store $store)
628628
}
629629

630630
/**
631-
* @return \Magento\Framework\Model\Entity\MetadataPool
631+
* @return \Magento\Framework\EntityManager\MetadataPool
632632
*/
633633
private function getMetadataPool()
634634
{
635635
if (null === $this->metadataPool) {
636636
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
637-
->get('Magento\Framework\Model\Entity\MetadataPool');
637+
->get('Magento\Framework\EntityManager\MetadataPool');
638638
}
639639
return $this->metadataPool;
640640
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/AbstractAction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
use Magento\Catalog\Api\Data\ProductInterface;
99
use Magento\Framework\App\ResourceConnection;
10-
use Magento\Framework\Model\Entity\MetadataPool;
10+
use Magento\Framework\EntityManager\MetadataPool;
1111

1212
/**
1313
* Abstract action reindex class
@@ -335,13 +335,13 @@ protected function _isFlatTableExists($storeId)
335335
}
336336

337337
/**
338-
* @return \Magento\Framework\Model\Entity\MetadataPool
338+
* @return \Magento\Framework\EntityManager\MetadataPool
339339
*/
340340
private function getMetadataPool()
341341
{
342342
if (null === $this->metadataPool) {
343343
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
344-
->get('Magento\Framework\Model\Entity\MetadataPool');
344+
->get('Magento\Framework\EntityManager\MetadataPool');
345345
}
346346
return $this->metadataPool;
347347
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use Magento\Catalog\Api\Data\ProductInterface;
1010
use Magento\Framework\App\ResourceConnection;
11-
use Magento\Framework\Model\Entity\MetadataPool;
11+
use Magento\Framework\EntityManager\MetadataPool;
1212

1313
/**
1414
* Class Indexer
@@ -180,13 +180,13 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
180180
}
181181

182182
/**
183-
* @return \Magento\Framework\Model\Entity\MetadataPool
183+
* @return \Magento\Framework\EntityManager\MetadataPool
184184
*/
185185
private function getMetadataPool()
186186
{
187187
if (null === $this->metadataPool) {
188188
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
189-
->get('Magento\Framework\Model\Entity\MetadataPool');
189+
->get('Magento\Framework\EntityManager\MetadataPool');
190190
}
191191
return $this->metadataPool;
192192
}

0 commit comments

Comments
 (0)