23 private $createdTableAdapters = [];
38 private $temporaryTableService;
51 $this->hashMapPool = $hashMapPool;
52 $this->temporaryTableService = $temporaryTableService;
61 private function generateTableAdapter($categoryId)
63 if (!isset($this->createdTableAdapters[$categoryId])) {
64 $this->createdTableAdapters[$categoryId] = $this->generateData($categoryId);
71 public function getData($categoryId, $key)
73 $this->generateTableAdapter($categoryId);
74 $urlRewritesConnection = $this->connection->getConnection();
75 $select = $urlRewritesConnection->select()
76 ->from([
'e' => $this->createdTableAdapters[$categoryId]])
77 ->where(
'hash_key = ?', $key);
78 return $urlRewritesConnection->fetchAll(
$select);
88 private function generateData($categoryId)
90 $urlRewritesConnection = $this->connection->getConnection();
91 $select = $urlRewritesConnection->select()
93 [
'e' => $this->connection->getTableName(
'url_rewrite')],
94 [
'e.*',
'hash_key' => new \Zend_Db_Expr(
99 ->where(
'entity_type = ?', self::ENTITY_TYPE)
101 $urlRewritesConnection->prepareSqlCondition(
104 'in' => $this->hashMapPool->getDataMap(DataProductHashMap::class, $categoryId)
105 ->getAllData($categoryId)
109 $mapName = $this->temporaryTableService->createFromSelect(
111 $this->connection->getConnection(),
113 'PRIMARY' => [
'url_rewrite_id'],
114 'HASHKEY_ENTITY_STORE' => [
'hash_key'],
115 'ENTITY_STORE' => [
'entity_id',
'store_id']
126 $this->hashMapPool->resetMap(DataProductHashMap::class, $categoryId);
127 if (isset($this->createdTableAdapters[$categoryId])) {
128 $this->temporaryTableService->dropTable($this->createdTableAdapters[$categoryId]);
129 unset($this->createdTableAdapters[$categoryId]);
__construct(ResourceConnection $connection, HashMapPool $hashMapPool, TemporaryTableService $temporaryTableService)
destroyTableAdapter($categoryId)
getData($categoryId, $key)