mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #1683 from andydhobbs/ticket-4108
Fix fields cache to depend on the schemaName as well. Fixes #4108
This commit is contained in:
commit
ad1b80645d
2 changed files with 23 additions and 0 deletions
|
@ -2281,6 +2281,7 @@ class DboSource extends DataSource {
|
|||
$fields,
|
||||
$quote,
|
||||
ConnectionManager::getSourceName($this),
|
||||
$model->schemaName,
|
||||
$model->table
|
||||
);
|
||||
$cacheKey = md5(serialize($cacheKey));
|
||||
|
|
|
@ -945,6 +945,28 @@ class DboSourceTest extends CakeTestCase {
|
|||
$this->assertEquals(2, count(DboTestSource::$methodCache['fields']));
|
||||
}
|
||||
|
||||
/**
|
||||
* test that fields() method cache detects schema name changes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFieldsCacheKeyWithSchemanameChange() {
|
||||
Cache::delete('method_cache', '_cake_core_');
|
||||
DboSource::$methodCache = array();
|
||||
$Article = ClassRegistry::init('Article');
|
||||
|
||||
$ds = $Article->getDataSource();
|
||||
$ds->cacheMethods = true;
|
||||
$first = $ds->fields($Article);
|
||||
|
||||
$Article->schemaName = 'secondSchema';
|
||||
$ds = $Article->getDataSource();
|
||||
$ds->cacheMethods = true;
|
||||
$second = $ds->fields($Article);
|
||||
|
||||
$this->assertEquals(2, count(DboSource::$methodCache['fields']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that group works without a model
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue