Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdatedIdListProvider.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  private $resourceConnection;
20 
24  private $connection;
25 
30  public function __construct(
31  ResourceConnection $resourceConnection
32  ) {
33  $this->resourceConnection = $resourceConnection;
34  }
35 
39  public function getIds($mainTableName, $gridTableName)
40  {
41  $mainTableName = $this->resourceConnection->getTableName($mainTableName);
42  $gridTableName = $this->resourceConnection->getTableName($gridTableName);
43  $select = $this->getConnection()->select()
44  ->from($mainTableName, [$mainTableName . '.entity_id'])
45  ->joinLeft(
46  [$gridTableName => $gridTableName],
47  sprintf(
48  '%s.%s = %s.%s',
49  $mainTableName,
50  'entity_id',
51  $gridTableName,
52  'entity_id'
53  ),
54  []
55  )
56  ->where($gridTableName . '.entity_id IS NULL');
57 
58  return $this->getConnection()->fetchAll($select, [], \Zend_Db::FETCH_COLUMN);
59  }
60 
66  private function getConnection()
67  {
68  if (!$this->connection) {
69  $this->connection = $this->resourceConnection->getConnection('sales');
70  }
71 
72  return $this->connection;
73  }
74 }
const FETCH_COLUMN
Definition: Db.php:147