3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
6
7
namespace Magento \UrlRewrite \Model \Storage ;
7
8
8
9
use Magento \Framework \Api \DataObjectHelper ;
12
13
use Magento \UrlRewrite \Service \V1 \Data \UrlRewrite ;
13
14
use Magento \UrlRewrite \Service \V1 \Data \UrlRewriteFactory ;
14
15
use Psr \Log \LoggerInterface ;
15
- use Magento \UrlRewrite \Service \V1 \Data \UrlRewrite as UrlRewriteData ;
16
+ use Magento \Framework \App \ObjectManager ;
17
+ use Magento \Framework \DB \Adapter \AdapterInterface ;
16
18
17
19
/**
18
20
* Url rewrites DB storage.
@@ -32,7 +34,7 @@ class DbStorage extends AbstractStorage
32
34
const ERROR_CODE_DUPLICATE_ENTRY = 1062 ;
33
35
34
36
/**
35
- * @var \Magento\Framework\DB\Adapter\ AdapterInterface
37
+ * @var AdapterInterface
36
38
*/
37
39
protected $ connection ;
38
40
@@ -47,9 +49,9 @@ class DbStorage extends AbstractStorage
47
49
private $ logger ;
48
50
49
51
/**
50
- * @param \Magento\UrlRewrite\Service\V1\Data\ UrlRewriteFactory $urlRewriteFactory
52
+ * @param UrlRewriteFactory $urlRewriteFactory
51
53
* @param DataObjectHelper $dataObjectHelper
52
- * @param \Magento\Framework\App\ ResourceConnection $resource
54
+ * @param ResourceConnection $resource
53
55
* @param LoggerInterface|null $logger
54
56
*/
55
57
public function __construct (
@@ -60,7 +62,7 @@ public function __construct(
60
62
) {
61
63
$ this ->connection = $ resource ->getConnection ();
62
64
$ this ->resource = $ resource ;
63
- $ this ->logger = $ logger ?: \ Magento \ Framework \ App \ ObjectManager::getInstance ()
65
+ $ this ->logger = $ logger ?: ObjectManager::getInstance ()
64
66
->get (LoggerInterface::class);
65
67
66
68
parent ::__construct ($ urlRewriteFactory , $ dataObjectHelper );
@@ -70,7 +72,7 @@ public function __construct(
70
72
* Prepare select statement for specific filter
71
73
*
72
74
* @param array $data
73
- * @return \Magento\Framework\DB\ Select
75
+ * @return Select
74
76
*/
75
77
protected function prepareSelect (array $ data )
76
78
{
@@ -80,6 +82,7 @@ protected function prepareSelect(array $data)
80
82
foreach ($ data as $ column => $ value ) {
81
83
$ select ->where ($ this ->connection ->quoteIdentifier ($ column ) . ' IN (?) ' , $ value );
82
84
}
85
+
83
86
return $ select ;
84
87
}
85
88
@@ -214,12 +217,12 @@ protected function doReplace(array $urls)
214
217
foreach ($ urls as $ url ) {
215
218
$ urlFound = $ this ->doFindOneByData (
216
219
[
217
- UrlRewriteData ::REQUEST_PATH => $ url ->getRequestPath (),
218
- UrlRewriteData ::STORE_ID => $ url ->getStoreId (),
220
+ UrlRewrite ::REQUEST_PATH => $ url ->getRequestPath (),
221
+ UrlRewrite ::STORE_ID => $ url ->getStoreId (),
219
222
]
220
223
);
221
- if (isset ($ urlFound [UrlRewriteData ::URL_REWRITE_ID ])) {
222
- $ urlConflicted [$ urlFound [UrlRewriteData ::URL_REWRITE_ID ]] = $ url ->toArray ();
224
+ if (isset ($ urlFound [UrlRewrite ::URL_REWRITE_ID ])) {
225
+ $ urlConflicted [$ urlFound [UrlRewrite ::URL_REWRITE_ID ]] = $ url ->toArray ();
223
226
}
224
227
}
225
228
if ($ urlConflicted ) {
@@ -281,6 +284,7 @@ protected function createFilterDataBasedOnUrls($urls)
281
284
}
282
285
}
283
286
}
287
+
284
288
return $ data ;
285
289
}
286
290
0 commit comments