Register custom Doctrine type in Symfony4
So I have this custom Doctrine type namespace App\Doctrine\Types; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\TextType; class MyType extends TextType { private $prefix=''; public function getName() { return 'my_type'; } public function setPrefix(string $prefix) { $this->prefix=$prefix; } } I registerd in in the config/packages/doctrine.yml: doctrine: dbal: types: my_type: App\Doctrine\Types\MyType Then in Kernel boot() I'm trying to add some parameters to this type: public function boot() { parent::boot(); $myType=Type::getType('my_type'); $myType->setPrefix('abc'); }