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);
75 private function generateData($categoryId)
77 $urlRewritesConnection = $this->connection->getConnection();
78 $select = $urlRewritesConnection->select()
80 [
'e' => $this->connection->getTableName(
'url_rewrite')],
81 [
'e.*',
'hash_key' => new \Zend_Db_Expr(
86 ->where(
'entity_type = ?', self::ENTITY_TYPE)
88 $urlRewritesConnection->prepareSqlCondition(
92 $this->hashMapPool->getDataMap(DataCategoryUsedInProductsHashMap::class, $categoryId)
93 ->getAllData($categoryId),
94 $this->hashMapPool->getDataMap(DataCategoryHashMap::class, $categoryId)
95 ->getAllData($categoryId)
100 $mapName = $this->temporaryTableService->createFromSelect(
102 $this->connection->getConnection(),
104 'PRIMARY' => [
'url_rewrite_id'],
105 'HASHKEY_ENTITY_STORE' => [
'hash_key'],
106 'ENTITY_STORE' => [
'entity_id',
'store_id']
117 $this->hashMapPool->resetMap(DataCategoryUsedInProductsHashMap::class, $categoryId);
118 $this->hashMapPool->resetMap(DataCategoryHashMap::class, $categoryId);
119 if (isset($this->createdTableAdapters[$categoryId])) {
120 $this->temporaryTableService->dropTable($this->createdTableAdapters[$categoryId]);
121 unset($this->createdTableAdapters[$categoryId]);
134 $this->generateTableAdapter($categoryId);
135 $urlRewritesConnection = $this->connection->getConnection();
136 $select = $urlRewritesConnection->select()->from([
'e' => $this->createdTableAdapters[$categoryId]]);
137 if (strlen($key) > 0) {
138 $select->where(
'hash_key = ?', $key);
141 return $urlRewritesConnection->fetchAll(
$select);
destroyTableAdapter($categoryId)
__construct(ResourceConnection $connection, HashMapPool $hashMapPool, TemporaryTableService $temporaryTableService)
getData($categoryId, $key)