|
|
@@ -3,15 +3,13 @@
|
|
|
namespace App\Service\Export;
|
|
|
|
|
|
|
|
|
-use App\Entity\Core\File;
|
|
|
-use App\Entity\Export\LicenceCmf;
|
|
|
+use App\Service\Export\Model\LicenceCmf;
|
|
|
use App\Enum\Access\FunctionEnum;
|
|
|
use App\Repository\Access\AccessRepository;
|
|
|
use App\Repository\Organization\OrganizationRepository;
|
|
|
use App\Service\Export\Encoder\PdfEncoder;
|
|
|
use App\Service\Storage\TemporaryFileStorage;
|
|
|
use App\Service\Utils\Path;
|
|
|
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
|
use Twig\Environment;
|
|
|
|
|
|
/**
|
|
|
@@ -31,7 +29,6 @@ class LicenceCmfExporter extends BaseExporter
|
|
|
private OrganizationRepository $organizationRepository,
|
|
|
private AccessRepository $accessRepository,
|
|
|
private Environment $twig,
|
|
|
- private UrlGeneratorInterface $router,
|
|
|
private PdfEncoder $pdfEncoder
|
|
|
)
|
|
|
{}
|
|
|
@@ -41,7 +38,7 @@ class LicenceCmfExporter extends BaseExporter
|
|
|
*/
|
|
|
public function export($exportRequest)
|
|
|
{
|
|
|
- $organization = $this->organizationRepository->find($exportRequest->getOrganizationId());
|
|
|
+ $organization = $exportRequest->getRequester()->getOrganization();
|
|
|
$currentYear = date('Y');
|
|
|
|
|
|
$model = new LicenceCmf();
|
|
|
@@ -94,25 +91,12 @@ class LicenceCmfExporter extends BaseExporter
|
|
|
$tempDir = TemporaryFileStorage::makeStorageDirFor($organization->getId());
|
|
|
$tempPath = Path::join($tempDir, $filename);
|
|
|
|
|
|
-// $file = new File();
|
|
|
-// $file->setOrganization($organization);
|
|
|
-// $file->setPath($location);
|
|
|
-// $file->setSlug($location);
|
|
|
-// $file->setName(basename($location));
|
|
|
-// $file->setMimeType('application/pdf');
|
|
|
-// $file->setVisibility('NOBODY');
|
|
|
-// $file->setFolder('DOCUMENTS');
|
|
|
-// $file->setType($model::TYPE);
|
|
|
-// $file->setCreateDate(new \DateTime());
|
|
|
-// $file->setCreatedBy($exportRequest->getRequester()->getId());
|
|
|
-
|
|
|
if (file_exists($tempPath)) {
|
|
|
unlink($tempPath);
|
|
|
}
|
|
|
|
|
|
$this->pdfEncoder->encodeToFile($html, $tempPath);
|
|
|
|
|
|
- return $tempPath;
|
|
|
}
|
|
|
|
|
|
/**
|