@@ -168,28 +168,30 @@ private function getFinalTargetUrlRewrite(string $path, int $storeId): ?UrlRewri
168
168
*/
169
169
private function cleanEntitiesCache ()
170
170
{
171
- if ($ this ->getEntityType () === Rewrite::ENTITY_TYPE_CUSTOM ) {
172
- $ urlRewrite = $ this ->getFinalTargetUrlRewrite (
173
- $ this ->getTargetPath (),
174
- (int )$ this ->getStoreId ()
175
- );
171
+ if (!$ this ->isEmpty ()) {
172
+ if ($ this ->getEntityType () === Rewrite::ENTITY_TYPE_CUSTOM ) {
173
+ $ urlRewrite = $ this ->getFinalTargetUrlRewrite (
174
+ $ this ->getTargetPath (),
175
+ (int )$ this ->getStoreId ()
176
+ );
176
177
177
- if ($ urlRewrite ) {
178
- $ this ->cleanCacheForEntity ($ urlRewrite ->getEntityType (), (int ) $ urlRewrite ->getEntityId ());
179
- }
178
+ if ($ urlRewrite ) {
179
+ $ this ->cleanCacheForEntity ($ urlRewrite ->getEntityType (), (int ) $ urlRewrite ->getEntityId ());
180
+ }
180
181
181
- if ($ this ->getOrigData () && $ this ->getOrigData ('target_path ' ) !== $ this ->getTargetPath ()) {
182
- $ origUrlRewrite = $ this ->getFinalTargetUrlRewrite (
183
- $ this ->getOrigData ('target_path ' ),
184
- (int )$ this ->getOrigData ('store_id ' )
185
- );
182
+ if ($ this ->getOrigData () && $ this ->getOrigData ('target_path ' ) !== $ this ->getTargetPath ()) {
183
+ $ origUrlRewrite = $ this ->getFinalTargetUrlRewrite (
184
+ $ this ->getOrigData ('target_path ' ),
185
+ (int )$ this ->getOrigData ('store_id ' )
186
+ );
186
187
187
- if ($ origUrlRewrite ) {
188
- $ this ->cleanCacheForEntity ($ origUrlRewrite ->getEntityType (), (int ) $ origUrlRewrite ->getEntityId ());
188
+ if ($ origUrlRewrite ) {
189
+ $ this ->cleanCacheForEntity ($ origUrlRewrite ->getEntityType (), (int ) $ origUrlRewrite ->getEntityId ());
190
+ }
189
191
}
192
+ } else {
193
+ $ this ->cleanCacheForEntity ($ this ->getEntityType (), (int ) $ this ->getEntityId ());
190
194
}
191
- } else {
192
- $ this ->cleanCacheForEntity ($ this ->getEntityType (), (int ) $ this ->getEntityId ());
193
195
}
194
196
}
195
197
0 commit comments