Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
5acb21d503 | |
|
6853bf95ae | |
|
e67eb62e57 |
|
@ -43,6 +43,16 @@ $result = $importService->import(
|
||||||
$logger
|
$logger
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧑💻 Exemple d'Importation dans le Contrôleur
|
||||||
|
|
||||||
|
Dans votre contrôleur ou service, n'oubliez pas d'importer les classes nécessaires pour utiliser le service d'importation :
|
||||||
|
|
||||||
|
```php
|
||||||
|
use Sudalys\ImportService\CsvImportService;
|
||||||
|
use Sudalys\ImportService\ExcelFileTransformer;
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -70,6 +80,21 @@ Géré via `ExcelFileTransformer` :
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## ⚙️ Configuration du Service dans `services.yaml`
|
||||||
|
|
||||||
|
Pour que le service fonctionne correctement dans Symfony, ajoutez la configuration suivante dans votre fichier `services.yaml` :
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
Sudalys\ImportService\:
|
||||||
|
resource: '../vendor/sudalys/import-service/src/Service/Import/'
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
public: false
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🎓 Exigences
|
## 🎓 Exigences
|
||||||
|
|
||||||
- PHP >= 8.1
|
- PHP >= 8.1
|
||||||
|
@ -82,3 +107,9 @@ Géré via `ExcelFileTransformer` :
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,11 @@ class RegexColumnSpecification implements ColumnSpecificationInterface
|
||||||
|
|
||||||
public function isSatisfiedBy(string $value): bool
|
public function isSatisfiedBy(string $value): bool
|
||||||
{
|
{
|
||||||
return preg_match($this->pattern, $value) === 1;
|
if(!empty($value) || !trim($value) === '') {
|
||||||
|
return preg_match($this->pattern, $value) === 1;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getErrorMessage(): string
|
public function getErrorMessage(): string
|
||||||
|
|
Loading…
Reference in New Issue