8
8
9
9
namespace Magento \CatalogUrlRewrite \Plugin \Eav \Model ;
10
10
11
-
12
11
use Magento \Catalog \Model \ResourceModel \Product \Collection ;
13
12
use Magento \Eav \Api \Data \AttributeSetInterface ;
14
13
use Magento \UrlRewrite \Model \UrlPersistInterface ;
@@ -43,9 +42,11 @@ public function __construct(UrlPersistInterface $urlPersist, Collection $product
43
42
* @param callable $proceed
44
43
* @param AttributeSetInterface $attributeSet
45
44
*/
46
- public function aroundDelete (\Magento \Eav \Model \AttributeSetRepository $ subject , callable $ proceed ,
47
- AttributeSetInterface $ attributeSet )
48
- {
45
+ public function aroundDelete (
46
+ \Magento \Eav \Model \AttributeSetRepository $ subject ,
47
+ callable $ proceed ,
48
+ AttributeSetInterface $ attributeSet
49
+ ) {
49
50
// Get the product ids
50
51
$ ids = $ this ->productCollection ->addFieldToFilter ('attribute_set_id ' , $ attributeSet ->getAttributeSetId ())
51
52
->getAllIds ();
@@ -54,15 +55,12 @@ public function aroundDelete(\Magento\Eav\Model\AttributeSetRepository $subject,
54
55
$ result = $ proceed ($ attributeSet );
55
56
56
57
// Delete the old product url rewrites
57
- try
58
- {
58
+ try {
59
59
$ this ->urlPersist ->deleteByData (['entity_id ' => $ ids , 'entity_type ' => 'product ' ]);
60
- }
61
- catch (\Exception $ exception )
62
- {
60
+ } catch (\Exception $ exception ) {
63
61
throw new CouldNotDeleteException (__ ('Could not delete the url rewrite(s): %1 ' , $ exception ->getMessage ()));
64
62
}
65
63
66
64
return $ result ;
67
65
}
68
- }
66
+ }
0 commit comments