Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BulkSummaryMapper.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  private $metadataPool;
21 
25  private $resourceConnection;
26 
31  public function __construct(
32  MetadataPool $metadataPool,
33  ResourceConnection $resourceConnection
34  ) {
35  $this->metadataPool = $metadataPool;
36  $this->resourceConnection = $resourceConnection;
37  }
38 
43  {
44  // workaround for delete/update operations that are currently using only primary key as identifier
45  if (!empty($data['uuid'])) {
46  $metadata = $this->metadataPool->getMetadata($entityType);
47  $connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
48  $select = $connection->select()->from($metadata->getEntityTable(), 'id')->where("uuid = ?", $data['uuid']);
49  $identifier = $connection->fetchOne($select);
50  if ($identifier !== false) {
51  $data['id'] = $identifier;
52  }
53  }
54  return $data;
55  }
56 
62  {
63  return $data;
64  }
65 }
__construct(MetadataPool $metadataPool, ResourceConnection $resourceConnection)
$connection
Definition: bulk.php:13