I want migrate some tables into Shopware 6 database. When I run this commande line
bin/console dal:create:schema
I get this error : [Error] Call to a member function getStorageName() on null. How can I solve this bug ? Could you help me please ?
CodePudding user response:
There's only one instance I can think of where this error might occur. It must be introduced by a plugin since this error would be caught before any release in the core.
There is a new EntityDefinition
or EntityExtension
(Definition A) which adds a ManyToOneAssociationField
. The association references another EntityDefinition
(Definition B). Definition B has implemented the isVersionAware
method to return true
. If definition A now misses to add a ReferenceVersionField
for definition B as well, this is when the field to retrieve the storage name from would remain to be null
, causing the error.
You can find the corresponding lines of code in the SchemaGenerator
.
For a correct implementation you can find the OrderAddressDefinition
which adds both a ManyToOneAssociationField
, as well as a ReferenceVersionField
for the OrderDefinition
(which is version aware). If you were to remove the ReferenceVersionField
you could reproduce this error without any plugins as well.
Either look at all the instances of EntityDefinition
/EntityExtension
within the plugins or try deactivating plugins one by one and try creating the schema again, until you find the plugin causing the error.