3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
7
+ declare (strict_types=1 );
8
+
6
9
namespace Magento \CatalogUrlRewrite \Model \ResourceModel \Category ;
7
10
8
11
use Magento \Framework \Model \ResourceModel \Db \AbstractDb ;
@@ -49,7 +52,7 @@ protected function _construct()
49
52
public function saveMultiple (array $ insertData )
50
53
{
51
54
$ connection = $ this ->getConnection ();
52
- if (sizeof ($ insertData ) <= self ::CHUNK_SIZE ) {
55
+ if (count ($ insertData ) <= self ::CHUNK_SIZE ) {
53
56
return $ connection ->insertMultiple ($ this ->getTable (self ::TABLE_NAME ), $ insertData );
54
57
}
55
58
$ data = array_chunk ($ insertData , self ::CHUNK_SIZE );
@@ -86,7 +89,7 @@ public function removeMultiple(array $removeData)
86
89
*/
87
90
public function removeMultipleByProductCategory (array $ filter )
88
91
{
89
- return $ this ->getConnection ()->deleteFromSelect ($ this ->prepareJoin ($ filter ), self ::TABLE_NAME );
92
+ return $ this ->getConnection ()->deleteFromSelect ($ this ->prepareSelect ($ filter ), self ::TABLE_NAME );
90
93
}
91
94
92
95
/**
@@ -95,7 +98,7 @@ public function removeMultipleByProductCategory(array $filter)
95
98
* @param array $data
96
99
* @return \Magento\Framework\DB\Select
97
100
*/
98
- private function prepareJoin ($ data )
101
+ private function prepareSelect ($ data )
99
102
{
100
103
$ select = $ this ->getConnection ()->select ();
101
104
$ select ->from (DbStorage::TABLE_NAME );
@@ -108,21 +111,4 @@ private function prepareJoin($data)
108
111
}
109
112
return $ select ;
110
113
}
111
-
112
- /**
113
- * Prepare select statement for specific filter
114
- *
115
- * @param array $data
116
- * @return \Magento\Framework\DB\Select
117
- */
118
- private function prepareSelect ($ data )
119
- {
120
- $ select = $ this ->getConnection ()->select ();
121
- $ select ->from ($ this ->getTable (DbStorage::TABLE_NAME ), 'url_rewrite_id ' );
122
-
123
- foreach ($ data as $ column => $ value ) {
124
- $ select ->where ($ this ->getConnection ()->quoteIdentifier ($ column ) . ' IN (?) ' , $ value );
125
- }
126
- return $ select ;
127
- }
128
114
}
0 commit comments