/** * @Secure(roles={"ROLE_CA"}) */ public function downloadAction(CampaignMailingFile $file) { if (!$this->get('enigmatic_crm.service.grant')->grantCampaignMailing($file->getCampaign())) { throw new AccessDeniedException(); } $fichier = $file->getAbsolutePath(); $filename = 'pj.' . substr(strrchr($fichier, '.'), 1); return new Response(file_get_contents($fichier), 200, array('Content-Type' => 'application/force-download', 'Content-disposition' => 'filename=' . $filename)); }
/** * Remove files * * @param \Enigmatic\CRMBundle\Entity\CampaignMailingFile $files */ public function removeFile(\Enigmatic\CRMBundle\Entity\CampaignMailingFile $files) { $this->files->removeElement($files); }