Forums › Forums › OroPlatform › Is there a hard reset of ALL caches (in files, databases, config)?
This topic contains 7 replies, has 3 voices, and was last updated by Andrey Yatsenko 5 years, 11 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- April 10, 2018 at 6:15 am #37133
Is there a hard reset of ALL caches (in files, databases, config) that could exist in OroPlatform or OroCRM?
If not, how do I hard reset ALL caches that can possibly exists in Oro?
- CreatorTopic
- AuthorReplies
- April 10, 2018 at 6:27 am #37134
I want to do this because I have an Entity placed in namespace “MyBundle/Entity”. But I moved the class to another bundle namespace “MyAnotherBundle/Entity” and I changed all my PHP code to get the new namespace (the ‘use’ imports in each file and the ‘.yml’ config files).
But when I try to up the server or clear cache of Oro (php app/console cache:clear), appears a message like “Target entity class ‘MyEntity’ could be found in ‘MyBundle/Entity/'”.
How do I hard reset EVERYTHING that Oro can possibly cache?
April 11, 2018 at 10:38 am #37135?
April 11, 2018 at 11:08 am #37136Hi spyout98,
It’s not just about cache. Unfortunately the configuration already loaded to the database and you already have links to that entity class in some places of the system, like workflow, search, migrations, navigation, acl and so on.
We had similar case when migrated entities from OroCRM to Oro namespaces. For that migration we used cache warmer that was triggered during platform update, there is a separate command created for that purpose, named
oro:platform:upgrade20:db-configs
The command loads services registered with tag
oro_installer.namespace_migration_provider
For example you can check https://github.com/oroinc/crm/blob/2.6.1/src/Oro/Bundle/CRMBundle/Cache/NamespaceMigrationProvider.php
Probably you can create your own namespace migration provider with specifying in $additionConfig property what should be replaced to what.
After running command all usage places should be updated.April 11, 2018 at 12:39 pm #37137Could you make a simple example about how do I do this in my custom bundle?
For example:
If I have a ‘MyBundle’ bundle already installed in Oro. So, I should create a file placed in ‘[my-orocrm-path]/src/MyBundle/Cache/NamespaceMigrationProvider.php’. The content of this file should be something like this below:
PHP1234567891011121314151617181920212223<?php# [my-orocrm-path]/src/MyBundle/Cache/NamespaceMigrationProvider.phpnamespace MyBundle\Cache;use Oro\Bundle\InstallerBundle\CacheWarmer\NamespaceMigrationProviderInterface;class NamespaceMigrationProvider implements NamespaceMigrationProviderInterface{/** @var string[] */protected $additionConfig= ['MyOld/Namespace/For/Entity' => 'MyNew/Namespace/For/Entity'];/*** (@inheritdoc}*/public function getConfig(){return $this->additionConfig;}}After, I have to create the ‘[my-orocrm-path]/src/MyBundle/Resources/config/services.yml’, with its content:
YAML12345services:my_bundle.namespace_migration_provider:class: 'MyBundle\Cache\NamespaceMigrationProvider'tags:- {name: my_bundle.namespace_migration_provider, priority: 40}Once created these files, how do I execute it? Is there some command in terminal for it?
April 11, 2018 at 1:10 pm #37138By the way, if we are talking about the local development environment here – then re-installation from scratch will be much faster solution. 5 minutes – and you are done.
April 11, 2018 at 1:16 pm #37139This system is already in production. I can’t just reinstall. That’s why I need a example code for this.
April 11, 2018 at 1:34 pm #37140The command name is ‘oro:platform:upgrade20:db-configs’
But makesure you made database dump before running it - AuthorReplies
The forum ‘OroPlatform’ is closed to new topics and replies.