Skip to content

Commit

Permalink
Remove SF Validator based filters & conditions (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd authored Oct 4, 2023
1 parent 9dd0330 commit 7f83be4
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 505 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
"ramsey/uuid": "^4.5",
"symfony/cache": "^6.2",
"symfony/dotenv": "^6.2",
"symfony/uid": "^6.3",
"symfony/validator": "^5.4 || ^6.2"
"symfony/uid": "^6.3"
},
"autoload": {
"files": [
Expand Down
256 changes: 1 addition & 255 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions src/core/etl/docs/complex_transformers.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Available Filters
- [entry number](../src/Flow/ETL/Transformer/Filter/Filter/EntryNumber.php)
- [entry exists](../src/Flow/ETL/Transformer/Filter/Filter/EntryExists.php)
- [opposite](../src/Flow/ETL/Transformer/Filter/Filter/Opposite.php)
- [valid value](../src/Flow/ETL/Transformer/Filter/Filter/ValidValue.php) - optionally integrates with [symfony validator](https://github.com/symfony/validator)

#### Transformer - Conditional

Expand All @@ -48,7 +47,6 @@ Available Conditions
- [entry value less than](../src/Flow/ETL/Transformer/Condition/EntryValueLessThan.php)
- [none](../src/Flow/ETL/Transformer/Condition/None.php)
- [opposite](../src/Flow/ETL/Transformer/Condition/Opposite.php)
- [valid value](../src/Flow/ETL/Transformer/Condition/ValidValue) - optionally integrates with [Symfony Validator](https://github.com/symfony/validator)


#### Transformer - Cast
Expand Down Expand Up @@ -85,4 +83,4 @@ Available styles:
* `dot`


[<< back](../README.md)
[<< back](../README.md)
11 changes: 0 additions & 11 deletions src/core/etl/src/Flow/ETL/DSL/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

namespace Flow\ETL\DSL;

use Flow\ETL\Exception\RuntimeException;
use Flow\ETL\Row\Entry;
use Flow\ETL\Transformer\Condition as TransformerCondition;
use Flow\ETL\Transformer\Condition\RowCondition;
use Symfony\Component\Validator\Constraint;

/**
* @infection-ignore-all
Expand Down Expand Up @@ -120,15 +118,6 @@ final public static function is_string(string $entry) : RowCondition
return new TransformerCondition\EntryInstanceOf($entry, Entry\StringEntry::class);
}

final public static function is_valid(string $entry, Constraint ...$constraints) : RowCondition
{
if (!\class_exists('\Symfony\Component\Validator\Validation')) {
throw new RuntimeException("Symfony\Component\Validator\Validation class not found, please add symfony/validator dependency to the project first.");
}

return new TransformerCondition\ValidValue($entry, new TransformerCondition\ValidValue\SymfonyValidator($constraints));
}

final public static function less_or_equals_value(string $entry, mixed $value) : RowCondition
{
return new TransformerCondition\EntryValueLessOrEqualThan($entry, $value);
Expand Down
12 changes: 0 additions & 12 deletions src/core/etl/src/Flow/ETL/DSL/Transform.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@
use Flow\ETL\Transformer\Filter\Filter\EntryNotNull;
use Flow\ETL\Transformer\Filter\Filter\EntryNumber;
use Flow\ETL\Transformer\Filter\Filter\Opposite;
use Flow\ETL\Transformer\Filter\Filter\ValidValue;
use Flow\ETL\Transformer\FilterRowsTransformer;
use Flow\ETL\Transformer\KeepEntriesTransformer;
use Flow\ETL\Transformer\Rename\EntryRename;
use Flow\ETL\Transformer\RenameEntriesTransformer;
use Flow\ETL\Transformer\StyleConverter\StringStyles;
use Laminas\Hydrator\ReflectionHydrator;
use Symfony\Component\Validator\Constraint;

/**
* @infection-ignore-all
Expand Down Expand Up @@ -166,11 +164,6 @@ final public static function filter_exists(string $entry) : Transformer
return new FilterRowsTransformer(new EntryExists($entry));
}

final public static function filter_invalid(string $entry, Constraint ...$constraints) : Transformer
{
return new FilterRowsTransformer(new ValidValue($entry, new ValidValue\SymfonyValidator($constraints)));
}

final public static function filter_not_equals(string $entry, mixed $value) : Transformer
{
return new FilterRowsTransformer(new Opposite(new EntryEqualsTo($entry, $value)));
Expand Down Expand Up @@ -201,11 +194,6 @@ final public static function filter_number(string $entry) : Transformer
return new FilterRowsTransformer(new EntryNumber($entry));
}

final public static function filter_valid(string $entry, Constraint ...$constraints) : Transformer
{
return new FilterRowsTransformer(new Opposite(new ValidValue($entry, new ValidValue\SymfonyValidator($constraints))));
}

final public static function group_to_array(string $group_by_entry, string $new_entry_name) : Transformer
{
return new Transformer\GroupToArrayTransformer($group_by_entry, $new_entry_name);
Expand Down
Loading

0 comments on commit 7f83be4

Please sign in to comment.