Update Newsletters.php
Removes request interruption when options are not found
This commit is contained in:
@ -75,17 +75,18 @@ class Newsletters extends APIEndpoint {
|
|||||||
$newsletter->type
|
$newsletter->type
|
||||||
)->findMany();
|
)->findMany();
|
||||||
|
|
||||||
if (!count($option_fields)) return;
|
if(count($option_fields)) {
|
||||||
|
|
||||||
foreach($option_fields as $option_field) {
|
foreach($option_fields as $option_field) {
|
||||||
if(isset($options[$option_field->name])) {
|
if(isset($options[$option_field->name])) {
|
||||||
$newsletter_option = NewsletterOption::createOrUpdate(
|
$newsletter_option = NewsletterOption::createOrUpdate(
|
||||||
array(
|
array(
|
||||||
'newsletter_id' => $newsletter->id,
|
'newsletter_id' => $newsletter->id,
|
||||||
'option_field_id' => $option_field->id,
|
'option_field_id' => $option_field->id,
|
||||||
'value' => $options[$option_field->name]
|
'value' => $options[$option_field->name]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user