public function sendCustodianWorkflowDocuments(User $ria, Workflow $workflow) { $documents = array(); if ($workflow->canHaveDocuments()) { /** @var DocumentSignature $signature */ foreach ($workflow->getDocumentSignatures() as $signature) { $document = $signature->getDocument(); $documents[$document->getOriginalName()] = $this->router->generate('rx_download_document', array('filename' => $document->getFilename(), 'originalName' => $document->getOriginalName()), true); } } if (count($documents)) { $template = $this->parameters['template']['docusign_custodian_workflow_documents']; $fromEmail = $this->parameters['from_email']['docusign_custodian_workflow_documents']; $custodian = $ria->getCustodian(); $context = array('custodian' => $custodian, 'ria' => $ria, 'logo' => $this->getRiaLogo($ria->getId())); return $this->sendMessage($template, $fromEmail, $custodian->getEmail(), $context, $documents); } return 0; }