Example #1
0
 if (!empty($i['labels'])) {
     $issue->setLabels($i['labels']);
 }
 $issue->save();
 if (isset($i['history'])) {
     foreach ($i['history'] as $h) {
         createHistory($issue, $h);
     }
 }
 if (isset($i['responses'])) {
     foreach ($i['responses'] as $res) {
         $response = new Response();
         $response->setIssue($issue);
         if (!empty($res['date'])) {
             $d = DateTime::createFromFormat('U', $res['date']->sec);
             $response->setDate($d->format('Y-m-d H:i:s'));
         }
         if (!empty($res['contactMethod'])) {
             handleContactMethod($response, $res, 'contactMethod');
         }
         if (!empty($res['notes'])) {
             $response->setNotes($res['notes']);
         }
         if (!empty($res['person']['_id'])) {
             $id = getPersonIdFromCrosswalk($res['person']['_id']);
             if ($id) {
                 $response->setPerson_id($id);
             }
         }
         $response->save();
     }