public function sendInvoiceEmail(Invoice $invoice, Parameters $data, array $fileData)
 {
     $params = new Parameters();
     if (!isset($data->default) && isset($data->smtp) && $data->smtp > 0) {
         $smtp = $this->settingsService->getSmtpById($data->smtp);
         $params->transport = $smtp->getTransport();
     }
     $params->from = $data->from;
     $params->to = $data->to;
     $params->header = $data->header;
     $params->content = $data->content;
     $params->file = $fileData['file'];
     $params->fileName = $fileData['fileName'];
     $this->mailService->sendInvoiceWithParams($invoice, $params);
 }
 public function sendInvoiceEmail(Document $invoice, Parameters $data, $documentFile)
 {
     $companyFiles = array();
     $params = new Parameters();
     if (isset($data->smtp) && $data->smtp > 0) {
         $smtp = $this->getOneObjectByField(SmtpOptions::getClass(), 'id', $data->smtp);
         $params->transport = $smtp->getTransport();
     }
     $params->from = $data->from;
     $params->to = $data->to;
     $params->header = $data->header;
     $params->content = $data->content;
     $params->documentFile = $documentFile;
     if (isset($data->companyFiles)) {
         foreach ($data->companyFiles as $id) {
             $companyFile = $this->getOneObjectByField(Company\File::getClass(), 'id', $id);
             $companyFiles[] = $companyFile;
         }
     }
     $params->companyFiles = $companyFiles;
     $this->mailService->sendInvoiceWithParams($invoice, $params);
 }