} // Address Service Fields $af = array(); if (!empty($r['neighborhoodAssociation'])) { $af['neighborhoodAssociation'] = $r['neighborhoodAssociation']; } if (!empty($r['township'])) { $af['township'] = $r['township']; } if (count($af)) { $data['additionalFields'] = json_encode($af); } if (!empty($r['resolution'])) { try { $resolution = new Resolution($r['resolution']); $data['resolution_id'] = $resolution->getId(); } catch (Exception $e) { } // Just ignore bad Resolutions } try { $zend_db->insert('tickets', $data); } catch (Exception $e) { // Just log the problem tickets and move on // We'll need to check the log once we're done echo "Ticket save failed: {$e->getMessage()}\n"; fwrite($TICKET_FAILURE_LOG, $e->getMessage() . "\n"); fwrite($TICKET_FAILURE_LOG, print_r($data, true)); fwrite($TICKET_FAILURE_LOG, print_r($r, true)); continue; }