Fix issues with is_null

This commit is contained in:
James Brooks
2015-11-21 22:01:13 +00:00
parent bf88dfced0
commit 27f1e6b8a4
4 changed files with 24 additions and 8 deletions

View File

@@ -42,7 +42,7 @@ class AddComponentCommandHandler
*/
protected function filter(AddComponentCommand $command)
{
return array_filter([
$params = [
'name' => $command->name,
'description' => $command->description,
'link' => $command->link,
@@ -50,6 +50,10 @@ class AddComponentCommandHandler
'enabled' => $command->enabled,
'order' => $command->order,
'group_id' => $command->group_id,
], 'is_null');
];
return array_filter($params, function ($val) {
return $val !== null;
});
}
}

View File

@@ -44,7 +44,7 @@ class UpdateComponentCommandHandler
*/
protected function filter(UpdateComponentCommand $command)
{
return array_filter([
$params = [
'name' => $command->name,
'description' => $command->description,
'link' => $command->link,
@@ -52,6 +52,10 @@ class UpdateComponentCommandHandler
'enabled' => $command->enabled,
'order' => $command->order,
'group_id' => $command->group_id,
], 'is_null');
];
return array_filter($params, function ($val) {
return $val !== null;
});
}
}

View File

@@ -88,7 +88,7 @@ class UpdateIncidentCommandHandler
*/
protected function filter(UpdateIncidentCommand $command)
{
return array_filter([
$params = [
'name' => $command->name,
'status' => $command->status,
'message' => $command->message,
@@ -96,7 +96,11 @@ class UpdateIncidentCommandHandler
'component_id' => $command->component_id,
'component_status' => $command->component_status,
'notify' => $command->notify,
], 'is_null');
];
return array_filter($params, function ($val) {
return $val !== null;
});
}
/**

View File

@@ -44,7 +44,7 @@ class UpdateMetricCommandHandler
*/
protected function filter(UpdateMetricCommand $command)
{
return array_filter([
$params = [
'name' => $command->name,
'suffix' => $command->suffix,
'description' => $command->description,
@@ -52,6 +52,10 @@ class UpdateMetricCommandHandler
'calc_type' => $command->calc_type,
'display_chart' => $command->display_chart,
'places' => $command->places,
], 'is_null');
];
return array_filter($params, function ($val) {
return $val !== null;
});
}
}