$dispatchModel->
getCategories()->
add($categoryModel);
} } foreach ($holidays as $holiday) { if (empty($holiday['id'
])) { continue;
} $holidayModel =
$this->
getModelManager()->
find(Holiday::
class,
$holiday['id'
]);
if ($holidayModel instanceof Holiday
) { $dispatchModel->
getHolidays()->
add($holidayModel);
} } try { $this->
getModelManager()->
flush();
$params['id'
] =
$dispatchModel->
getId();
} catch (Exception
$e) { $this->
View()->
assign(['success' => false, 'errorMsg' =>
$e->
getMessage()]);
return;
}