PHP code example of dennispansegrau / pimcore-content-migration-bundle

1. Go to this page and download the library: Download dennispansegrau/pimcore-content-migration-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dennispansegrau / pimcore-content-migration-bundle example snippets


return [
    // ...
    \PimcoreContentMigration\PimcoreContentMigrationBundle::class => ['all' => true],
];



namespace App\ContentMigration\Stringifier;

use App\Model\DataObject\Data\MyCustomDataType;
use PimcoreContentMigration\Converter\Stringifier\ValueStringifier;
use PimcoreContentMigration\Converter\Stringifier\Handler\Trait\ValueToStringConverterTrait;
use PimcoreContentMigration\Generator\Dependency\DependencyList;

final class MyCustomDataTypeStringifier implements ValueStringifier
{
    use ValueToStringConverterTrait;

    public function supports(mixed $value, array $parameters = []): bool
    {
        return $value instanceof MyCustomDataType;
    }

    public function toString(mixed $value, DependencyList $dependencyList, array $parameters = []): string
    {
        $data = $this->getConverter()->convertValueToString($value->getData(), $dependencyList, $parameters);

        return sprintf(
            'new \\App\\Model\\DataObject\\Data\\MyCustomDataType(%s)',
            $data
        );
    }
}