Loaders 

Additional loaders can be registered for loading seeding data. By default this extension ship a YAML loader. See Configuration file for an example.

Additional loaders can be registered using the PHP attribute \KM2\DataSeeder\Attribute\DataLoader .

Custom loader class example
<?php

namespace MyVendor\MyExtension\Loaders;

use KM2\DataSeeder\Attribute\DataLoader;
use KM2\DataSeeder\DataHandling\Loader\DataLoaderInterface;

#[DataLoader(identifier: 'myLoader')]
class MyCustomOperation implements OperationInterface
{
    public function load(array $options = []): SeedingData
    {
        $variables = new VariableCollection($options['variables']);
        $staticData = [
            'pages' => [
                [
                    'identifier' => 'home',
                    'pid' => '{pages:root}',
                    'title' => 'Home',
                    'doktype' => '{variable:defaultPageType}',
                ],
            ],
        ];

        return new SeedingData($staticData, $variables);
    }
}
Copied!
Custom loader configuration
data:
  loader: myLoader
  options:
    variables:
      defaultPageType: 1
Copied!