@@ -68,15 +68,17 @@ public function updateKeywordFolderAssociation(KeywordAssociationEvent $event)
68
68
->filterByFolderId ($ folder ->getId ())
69
69
->delete ();
70
70
71
- // Create all associations to this folder
72
- foreach ($ keywordListToSave as $ keywordId ) {
71
+ if ($ keywordListToSave !== null ) {
72
+ // Create all associations to this folder
73
+ foreach ($ keywordListToSave as $ keywordId ) {
73
74
74
- $ keywordFolderAssociation = new FolderAssociatedKeyword ();
75
- $ keywordFolderAssociation
76
- ->setFolderId ($ folder ->getId ())
77
- ->setKeywordId ($ keywordId )
78
- ->save ();
75
+ $ keywordFolderAssociation = new FolderAssociatedKeyword ();
76
+ $ keywordFolderAssociation
77
+ ->setFolderId ($ folder ->getId ())
78
+ ->setKeywordId ($ keywordId )
79
+ ->save ();
79
80
81
+ }
80
82
}
81
83
82
84
}
@@ -94,15 +96,17 @@ public function updateKeywordContentAssociation(KeywordAssociationEvent $event)
94
96
->filterByContentId ($ content ->getId ())
95
97
->delete ();
96
98
97
- // Create all associations to this folder
98
- foreach ($ keywordListToSave as $ keywordId ) {
99
+ if ($ keywordListToSave !== null ) {
100
+ // Create all associations to this folder
101
+ foreach ($ keywordListToSave as $ keywordId ) {
99
102
100
- $ keywordFolderAssociation = new ContentAssociatedKeyword ();
101
- $ keywordFolderAssociation
102
- ->setContentId ($ content ->getId ())
103
- ->setKeywordId ($ keywordId )
104
- ->save ();
103
+ $ keywordFolderAssociation = new ContentAssociatedKeyword ();
104
+ $ keywordFolderAssociation
105
+ ->setContentId ($ content ->getId ())
106
+ ->setKeywordId ($ keywordId )
107
+ ->save ();
105
108
109
+ }
106
110
}
107
111
108
112
}
@@ -120,15 +124,17 @@ public function updateKeywordCategoryAssociation(KeywordAssociationEvent $event)
120
124
->filterByCategoryId ($ category ->getId ())
121
125
->delete ();
122
126
123
- // Create all associations to this category
124
- foreach ($ keywordListToSave as $ keywordId ) {
127
+ if ($ keywordListToSave !== null ) {
128
+ // Create all associations to this category
129
+ foreach ($ keywordListToSave as $ keywordId ) {
125
130
126
- $ keywordCategoryAssociation = new CategoryAssociatedKeyword ();
127
- $ keywordCategoryAssociation
128
- ->setCategoryId ($ category ->getId ())
129
- ->setKeywordId ($ keywordId )
130
- ->save ();
131
+ $ keywordCategoryAssociation = new CategoryAssociatedKeyword ();
132
+ $ keywordCategoryAssociation
133
+ ->setCategoryId ($ category ->getId ())
134
+ ->setKeywordId ($ keywordId )
135
+ ->save ();
131
136
137
+ }
132
138
}
133
139
134
140
}
@@ -146,15 +152,17 @@ public function updateKeywordProductAssociation(KeywordAssociationEvent $event)
146
152
->filterByProductId ($ product ->getId ())
147
153
->delete ();
148
154
149
- // Create all associations to this folder
150
- foreach ($ keywordListToSave as $ keywordId ) {
155
+ if ($ keywordListToSave !== null ) {
156
+ // Create all associations to this folder
157
+ foreach ($ keywordListToSave as $ keywordId ) {
151
158
152
- $ keywordProductAssociation = new ProductAssociatedKeyword ();
153
- $ keywordProductAssociation
154
- ->setProductId ($ product ->getId ())
155
- ->setKeywordId ($ keywordId )
156
- ->save ();
159
+ $ keywordProductAssociation = new ProductAssociatedKeyword ();
160
+ $ keywordProductAssociation
161
+ ->setProductId ($ product ->getId ())
162
+ ->setKeywordId ($ keywordId )
163
+ ->save ();
157
164
165
+ }
158
166
}
159
167
160
168
}
0 commit comments