Migrates from deprecated Form Builder->setDataMapper(new PropertyPathMapper()) to Builder->setDataMapper(new DataMapper(new PropertyPathAccessor()))
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\FormConfigBuilderInterface;
+use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
+use Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor;
class SomeClass
{
public function run(FormConfigBuilderInterface $builder)
{
- $builder->setDataMapper(new PropertyPathMapper());
+ $builder->setDataMapper(new DataMapper(new PropertyPathAccessor()));
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony52\Rector\MethodCall\FormBuilderSetDataMapperRector;
return RectorConfig::configure()
->withRules([
FormBuilderSetDataMapperRector::class,
]);