Closed gringlas closed 3 years ago
Glad you are enjoying the plugin!
This is specific to the Uploaded plugin, and should probably not be handled by the factories.
What you could do is check in the ImageFactory::setDefaultTemplate()
method if the type exists (TypeFactory::getMap('upload.file')
), and if not found, TypeFactory::map('upload.file', FileType::class);
.
This way, your issue is solved for all the tests involving that factory.
This is working like a charme. Thank you! :)
When I try to create entities with a FixtureFactory on an entity which got added new DataTypes through a plugin I will get an exception, i.e.
InvalidArgumentException : Unknown type "upload.file"
In my case I'm using the UploadBehaviorPlugon in my ImagesTable, which declares a new Type 'upload.file' in its Plugin.php. I then wanted to use a ImageFactory to create an entity, like:I had to add
TypeFactory::map('upload.file', FileType::class);
to my ImagesTableTest class, to got it working. Is this the intended way, or is this an issue?Thanks for this great plugin!