Open klodoma opened 9 years ago
I've locally soved it with this, but I'm not sure if it's the correct solution
if (!Type::hasType('json')) {
Type::addType( 'json', '\Atrauzzi\LaravelDoctrine\Type\Json' );
$this->publishes( [ __DIR__ . '/..' . '/config/doctrine.php' => config_path( 'doctrine.php' ) ], 'config' );
}
Maybe this
doctrine.php
'custom_types' => [
'json' => Atrauzzi\LaravelDoctrine\Type\Json::class
],
In my boot method, there is a couple of code
public function boot() {
$this->registerCustomTypes();
$this->publishes([__DIR__ .'/..'. '/config/doctrine.php'=> config_path('doctrine.php')], 'config');
$this->commands([
'Atrauzzi\LaravelDoctrine\Console\CreateSchemaCommand',
'Atrauzzi\LaravelDoctrine\Console\UpdateSchemaCommand',
'Atrauzzi\LaravelDoctrine\Console\DropSchemaCommand'
]);
$this->extendsAuth();
}
protected function registerCustomTypes() {
foreach(config('doctrine.custom_types',array()) as $name=>$class)
{
if(!Type::hasType($name)){
Type::addType($name, $class);
}
else{
Type::overrideType($name, $class);
}
}
}
@klodoma Did you solve the problem?
Oje, completely forgot about this. I fixed it as mentioned, let me give it a try and come back on this.
When trying to execute multiple unit-tests, I am getting the following error: Type json already exists. This happens when the second unit-test is being executed. I assume that the APP is already initialized.
The error happens here. Any idea?