Magento 2 No Such Entity after deleting website
Today I had to rename a couple of websites / store views / stores in a multi-website configuration (a new Magento 2 build for a Magento 1 site). There were approximately 7 websites each with an individual store view.
The initial quest was to rename a couple of store views, so that they had very specific store view
store_id (due to the nature of a legacy backend system and the constraints imposed).
Version: Magento 2.1.2 CE
Mage mode: Production
What happened after the shuffle & delete
Once I had finally renamed every Website / Store View & Store and deleted the websites not required (including stores/store views) – I thought it would be a good idea to recompile:
php bin/magento setup:di:compile
and static files:
php bin/magento setup:static-content:deploy
After this had completed I decided to click around the backend to check data – I went to Customers but noticed a very strange message:
No such entity
I looked around and found out this was a bug but it was fixed: https://github.com/magento/magento2/issues/2921.
This means the problem I was experiencing was not related to that bug (since it was fixed).
I’m still not sure why this error occurs since I yet to fully understand dependency injection in general but there was a solution.
At my wits end without a good resource for an instant response (other than stack exchange or the Magento forum), I decided to obliterate the
pub/static directory completely:
rm -rf var/di && rm -rf pub/static
php bin/magento setup:di:compile && php bin/magento setup:static-content:deploy
and that did the trick. No more “No such entity.” problem.