File tree Expand file tree Collapse file tree 4 files changed +41
-80
lines changed
MediaContentCatalog/Observer Expand file tree Collapse file tree 4 files changed +41
-80
lines changed Original file line number Diff line number Diff line change @@ -50,27 +50,17 @@ public function execute(Observer $observer): void
50
50
/** @var CatalogCategory $model */
51
51
$ model = $ observer ->getEvent ()->getData ('category ' );
52
52
if ($ model instanceof AbstractModel) {
53
- $ this ->updateRelations ($ model );
54
- }
55
- }
56
-
57
- /**
58
- * Update relations for the model
59
- *
60
- * @param AbstractModel $model
61
- */
62
- private function updateRelations (AbstractModel $ model ): void
63
- {
64
- foreach ($ this ->fields as $ field ) {
65
- if (!$ model ->dataHasChangedFor ($ field )) {
66
- continue ;
53
+ foreach ($ this ->fields as $ field ) {
54
+ if (!$ model ->dataHasChangedFor ($ field )) {
55
+ continue ;
56
+ }
57
+ $ this ->processor ->execute (
58
+ self ::CONTENT_TYPE ,
59
+ $ field ,
60
+ (string ) $ model ->getId (),
61
+ (string ) $ model ->getData ($ field )
62
+ );
67
63
}
68
- $ this ->processor ->execute (
69
- self ::CONTENT_TYPE ,
70
- $ field ,
71
- (string ) $ model ->getId (),
72
- (string ) $ model ->getData ($ field )
73
- );
74
64
}
75
65
}
76
66
}
Original file line number Diff line number Diff line change @@ -49,28 +49,19 @@ public function execute(Observer $observer): void
49
49
{
50
50
/** @var CatalogProduct $model */
51
51
$ model = $ observer ->getEvent ()->getData ('product ' );
52
- if ($ model instanceof AbstractModel) {
53
- $ this ->updateRelations ($ model );
54
- }
55
- }
56
52
57
- /**
58
- * Update relations for the model
59
- *
60
- * @param AbstractModel $model
61
- */
62
- private function updateRelations (AbstractModel $ model ): void
63
- {
64
- foreach ($ this ->fields as $ field ) {
65
- if (!$ model ->dataHasChangedFor ($ field )) {
66
- continue ;
53
+ if ($ model instanceof AbstractModel) {
54
+ foreach ($ this ->fields as $ field ) {
55
+ if (!$ model ->dataHasChangedFor ($ field )) {
56
+ continue ;
57
+ }
58
+ $ this ->processor ->execute (
59
+ self ::CONTENT_TYPE ,
60
+ $ field ,
61
+ (string ) $ model ->getId (),
62
+ (string ) $ model ->getData ($ field )
63
+ );
67
64
}
68
- $ this ->processor ->execute (
69
- self ::CONTENT_TYPE ,
70
- $ field ,
71
- (string ) $ model ->getId (),
72
- (string ) $ model ->getData ($ field )
73
- );
74
65
}
75
66
}
76
67
}
Original file line number Diff line number Diff line change @@ -50,27 +50,17 @@ public function execute(Observer $observer): void
50
50
/** @var CmsBlock $model */
51
51
$ model = $ observer ->getEvent ()->getData ('object ' );
52
52
if ($ model instanceof AbstractModel) {
53
- $ this ->updateRelations ($ model );
54
- }
55
- }
56
-
57
- /**
58
- * Update relations for the model
59
- *
60
- * @param AbstractModel $model
61
- */
62
- private function updateRelations (AbstractModel $ model ): void
63
- {
64
- foreach ($ this ->fields as $ field ) {
65
- if (!$ model ->dataHasChangedFor ($ field )) {
66
- continue ;
53
+ foreach ($ this ->fields as $ field ) {
54
+ if (!$ model ->dataHasChangedFor ($ field )) {
55
+ continue ;
56
+ }
57
+ $ this ->processor ->execute (
58
+ self ::CONTENT_TYPE ,
59
+ $ field ,
60
+ (string ) $ model ->getId (),
61
+ (string ) $ model ->getData ($ field )
62
+ );
67
63
}
68
- $ this ->processor ->execute (
69
- self ::CONTENT_TYPE ,
70
- $ field ,
71
- (string ) $ model ->getId (),
72
- (string ) $ model ->getData ($ field )
73
- );
74
64
}
75
65
}
76
66
}
Original file line number Diff line number Diff line change @@ -50,27 +50,17 @@ public function execute(Observer $observer): void
50
50
/** @var CmsPage $model */
51
51
$ model = $ observer ->getEvent ()->getData ('object ' );
52
52
if ($ model instanceof AbstractModel) {
53
- $ this ->updateRelations ($ model );
54
- }
55
- }
56
-
57
- /**
58
- * Update relations for the model
59
- *
60
- * @param AbstractModel $model
61
- */
62
- private function updateRelations (AbstractModel $ model ): void
63
- {
64
- foreach ($ this ->fields as $ field ) {
65
- if (!$ model ->dataHasChangedFor ($ field )) {
66
- continue ;
53
+ foreach ($ this ->fields as $ field ) {
54
+ if (!$ model ->dataHasChangedFor ($ field )) {
55
+ continue ;
56
+ }
57
+ $ this ->processor ->execute (
58
+ self ::CONTENT_TYPE ,
59
+ $ field ,
60
+ (string ) $ model ->getId (),
61
+ (string ) $ model ->getData ($ field )
62
+ );
67
63
}
68
- $ this ->processor ->execute (
69
- self ::CONTENT_TYPE ,
70
- $ field ,
71
- (string ) $ model ->getId (),
72
- (string ) $ model ->getData ($ field )
73
- );
74
64
}
75
65
}
76
66
}
You can’t perform that action at this time.
0 commit comments