Skip to content

Commit

Permalink
Fix save commande
Browse files Browse the repository at this point in the history
  • Loading branch information
AYB committed May 2, 2024
1 parent c657a02 commit bd37819
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ abenmada_export_plugin:
prefix_timestamp: true
suffix_timestamp: false
file_name: export_customer_save
path: public/media
path: public/media # Path from project dir
metadata:
creator: Ayman Benmada
lastModifiedBy: Ayman Benmada
Expand Down
8 changes: 8 additions & 0 deletions src/Resources/config/packages/grid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ abenmada_export_plugin:
enabled: true
type: xlsx
file_name: export_customer
save:
type: csv
enabled: true
auto_size: true
prefix_timestamp: true
suffix_timestamp: false
file_name: export_customer_save
path: public/media
properties:
firstName:
label: sylius.ui.first_name
Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/packages/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
public: true
arguments:
- '@abenmada_export_plugin.service.write'
- '%kernel.project_dir%'

Abenmada\ExportPlugin\Service\DownloadServiceInterface:
alias: abenmada_export_plugin.service.download
Expand Down
4 changes: 2 additions & 2 deletions src/Service/SaveService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

final readonly class SaveService implements SaveServiceInterface
{
public function __construct(private WriteServiceInterface $writeService)
public function __construct(private WriteServiceInterface $writeService, private string $projectDir)
{
}

Expand Down Expand Up @@ -45,6 +45,6 @@ public function save(array $resources, array $properties, string $fileName, arra
default => new Xlsx($spreadsheet),
};

$writer->save('../' . $path . '/' . $fileName);
$writer->save($this->projectDir . '/' . $path . '/' . $fileName);
}
}

0 comments on commit bd37819

Please sign in to comment.