/** * Clear all caches present related to models * * Before the 'after' callback method be called is needed to clear all caches. * Without it any model operations will use cached data instead of real/modified * data. * * @return void */ protected function _clearCache() { // Clear the cache DboSource::$methodCache = array(); $keys = Cache::configured(); foreach ($keys as $key) { Cache::clear(false, $key); } ClassRegistry::flush(); // Refresh the model, in case something changed if ($this->Version instanceof MigrationVersion) { $this->Version->initVersion(); } }