Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DeleteRow.php
Go to the documentation of this file.
1 <?php
8 
11 
15 class DeleteRow
16 {
20  private $metadataPool;
21 
25  private $resourceConnection;
26 
33  public function __construct(
34  MetadataPool $metadataPool,
35  ResourceConnection $resourceConnection
36  ) {
37  $this->metadataPool = $metadataPool;
38  $this->resourceConnection = $resourceConnection;
39  }
40 
47  public function execute($entityType, $data)
48  {
49  $metadata = $this->metadataPool->getMetadata($entityType);
50  $connection = $this->resourceConnection->getConnectionByName($metadata->getEntityConnectionName());
51  return $connection->delete(
52  $metadata->getEntityTable(),
53  [$metadata->getLinkField() . ' = ?' => $data[$metadata->getLinkField()]]
54  );
55  }
56 }
__construct(MetadataPool $metadataPool, ResourceConnection $resourceConnection)
Definition: DeleteRow.php:33
$connection
Definition: bulk.php:13