@@ -63,10 +63,12 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s
63
63
}
64
64
65
65
$ oldStoreId = $ fromStore ->getId ();
66
- $ oldRewrite = $ this ->urlFinder ->findOneByData ([
67
- UrlRewrite::REQUEST_PATH => $ urlPath ,
68
- UrlRewrite::STORE_ID => $ oldStoreId ,
69
- ]);
66
+ $ oldRewrite = $ this ->urlFinder ->findOneByData (
67
+ [
68
+ UrlRewrite::REQUEST_PATH => $ urlPath ,
69
+ UrlRewrite::STORE_ID => $ oldStoreId ,
70
+ ]
71
+ );
70
72
if ($ oldRewrite ) {
71
73
$ targetUrl = $ targetStore ->getBaseUrl ();
72
74
// look for url rewrite match on the target store
@@ -75,13 +77,13 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s
75
77
$ targetUrl .= $ currentRewrite ->getRequestPath ();
76
78
}
77
79
} else {
78
- $ existingRewrite = $ this ->urlFinder ->findOneByData ([
79
- UrlRewrite:: REQUEST_PATH => $ urlPath
80
- ]);
81
- $ currentRewrite = $ this -> urlFinder -> findOneByData ([
82
- UrlRewrite::REQUEST_PATH => $ urlPath ,
83
- UrlRewrite:: STORE_ID => $ targetStore -> getId (),
84
- ] );
80
+ $ existingRewrite = $ this ->urlFinder ->findOneByData ([UrlRewrite:: REQUEST_PATH => $ urlPath ]);
81
+ $ currentRewrite = $ this -> urlFinder -> findOneByData (
82
+ [
83
+ UrlRewrite:: REQUEST_PATH => $ urlPath ,
84
+ UrlRewrite::STORE_ID => $ targetStore -> getId () ,
85
+ ]
86
+ );
85
87
86
88
if ($ existingRewrite && !$ currentRewrite ) {
87
89
/** @var \Magento\Framework\App\Response\Http $response */
@@ -100,15 +102,19 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s
100
102
*/
101
103
private function findCurrentRewrite (UrlRewrite $ oldRewrite , StoreInterface $ targetStore )
102
104
{
103
- $ currentRewrite = $ this ->urlFinder ->findOneByData ([
104
- UrlRewrite::TARGET_PATH => $ oldRewrite ->getTargetPath (),
105
- UrlRewrite::STORE_ID => $ targetStore ->getId (),
106
- ]);
107
- if (!$ currentRewrite ) {
108
- $ currentRewrite = $ this ->urlFinder ->findOneByData ([
109
- UrlRewrite::REQUEST_PATH => $ oldRewrite ->getTargetPath (),
105
+ $ currentRewrite = $ this ->urlFinder ->findOneByData (
106
+ [
107
+ UrlRewrite::TARGET_PATH => $ oldRewrite ->getTargetPath (),
110
108
UrlRewrite::STORE_ID => $ targetStore ->getId (),
111
- ]);
109
+ ]
110
+ );
111
+ if (!$ currentRewrite ) {
112
+ $ currentRewrite = $ this ->urlFinder ->findOneByData (
113
+ [
114
+ UrlRewrite::REQUEST_PATH => $ oldRewrite ->getTargetPath (),
115
+ UrlRewrite::STORE_ID => $ targetStore ->getId (),
116
+ ]
117
+ );
112
118
}
113
119
return $ currentRewrite ;
114
120
}
0 commit comments