Valinor/tests/Integration/Mapping
Nathan Boiron b7a7d22993
feat: introduce a path-mapping source modifier
This modifier can be used to change paths in the source data using a dot
notation.

The mapping is done using an associative array of path mappings. This
array must have the source path as key and the target path as value.

The source path uses the dot notation (eg `A.B.C`) and can contain one
`*` for array paths (eg `A.B.*.C`).

```php
final class Country
{
    /** @var City[] */
    public readonly array $cities;
}

final class City
{
    public readonly string $name;
}

$source = new \CuyZ\Valinor\Mapper\Source\Modifier\PathMapping([
    'towns' => [
        ['label' => 'Ankh Morpork'],
        ['label' => 'Minas Tirith'],
    ],
], [
    'towns' => 'cities',
    'towns.*.label' => 'name',
]);

// After modification this is what the source will look like:
[
    'cities' => [
        ['name' => 'Ankh Morpork'],
        ['name' => 'Minas Tirith'],
    ],
];

(new \CuyZ\Valinor\MapperBuilder())
    ->mapper()
    ->map(Country::class, $source);
```
2022-02-26 11:33:50 +01:00
..
Attribute fix: return indexed list of attributes when filtering on type 2022-01-26 18:59:57 +01:00
Fixture feat: introduce automatic union of objects inferring during mapping 2022-01-07 13:41:15 +01:00
Object qa: require and include phpstan/phpstan-phpunit rules 2022-02-19 19:58:28 +01:00
Other feat!: allow mapping to any type 2022-01-02 00:48:01 +01:00
Source feat: introduce a path-mapping source modifier 2022-02-26 11:33:50 +01:00
InterfaceInferringMappingTest.php feat!: improve interface inferring API 2022-02-24 10:48:49 +01:00
NamedConstructorTest.php feat: introduce automatic named constructor resolution 2022-01-25 18:32:28 +01:00
ObjectBindingMappingTest.php fix: transform exception thrown during object binding into a message 2022-02-24 11:27:27 +01:00
ReadonlyMappingTest.php feat: initial release 2021-11-28 18:21:56 +01:00
SingleNodeMappingTest.php feat: initial release 2021-11-28 18:21:56 +01:00
ValueAlteringMappingTest.php feat: improve value altering API 2022-02-19 19:58:28 +01:00
VariadicParameterMappingTest.php fix: remove string keys when unpacking variadic parameter values 2022-02-24 11:23:26 +01:00
VisitorMappingTest.php feat!: wrap node messages in proper class 2022-01-06 14:11:42 +01:00