/** * Store email attachments to local device * @param [mixed] $attachments [array of attachments] * @param [String] $location [storage location] */ private function _storeAttachments($attachments, $key, $location = "person") { if (is_array($attachments) && count($attachments) > 0) { $model = new Document(); foreach ($attachments as $attachment_key => $attachment) { $attachment->association_id = $key; $attachment->association_type = $location; $attachment->email = 1; $model->store($attachment); } } }