2

In patch which implements DataPatchInterface there is a method "getDependencies()" which seems to be used if one patch need to be played before current one. But problem is if required patch define in getDependencies was already played the cli setup:upgrade returns me "Patch xxx cannot be applied twice".

So how can I make sure that patch is played before another one if I init new environment ?

1 Answer 1

3

I don't know if it would help in your case (for someone else as information is quite scarce on the subject) but in mine it was due to misspelling in the namespace.

The idea is that once the patch is applied with the path to the patch in db and then retrieved using namespace.

1
  • 2
    This happened to me as well. I had a patch in the namespace mymodule\MODULE\Setup\Patch\Data, but I misspelled the namespace, using all characters lowercase (mymodule\module\Setup\Patch\Data). Magento 2 adds the namespace in the file to the table patch_list, but when it runs setup:upgrade, it uses the file system path to scan for new patches to be applied. Sep 11, 2020 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.