Skip to content

Instantly share code, notes, and snippets.

@damianoporta
Created October 13, 2014 12:17
Show Gist options
  • Save damianoporta/e05cb9c3e7e82fb6ff2a to your computer and use it in GitHub Desktop.
Save damianoporta/e05cb9c3e7e82fb6ff2a to your computer and use it in GitHub Desktop.
if (!empty($form['Ad']['AdService']))
{
$services = [];
foreach ($form['Ad']['AdService'] as $service)
{
array_push($services, [
'id' => $this->AdService->field('id', [
'AdService.ad_id' => $ad_id,
'AdService.service_id' => $service,
]),
'service_id' => $service,
'ad_id' => $ad_id,
]);
}
$form['Ad']['AdService'] = $services;
}
else
{
$form['Ad']['AdService'] = [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment