Allow to retreive association cache defaults
This commit is contained in:
parent
6b3056ff8c
commit
6a428c6064
@ -1078,18 +1078,29 @@ class ClassMetadataInfo implements ClassMetadata
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function enableAssociationCache($fieldName, array $cache)
|
public function enableAssociationCache($fieldName, array $cache)
|
||||||
|
{
|
||||||
|
$this->associationMappings[$fieldName]['cache'] = $this->getAssociationCacheDefaults ($fieldName, $cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $fieldName
|
||||||
|
* @param array $cache
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAssociationCacheDefaults ($fieldName, array $cache)
|
||||||
{
|
{
|
||||||
if ( ! isset($cache['usage'])) {
|
if ( ! isset($cache['usage'])) {
|
||||||
$cache['usage'] = isset($this->cache['usage'])
|
$cache['usage'] = isset($this->cache['usage'])
|
||||||
? $this->cache['usage']
|
? $this->cache['usage']
|
||||||
: self::CACHE_USAGE_READ_ONLY;
|
: self::CACHE_USAGE_READ_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! isset($cache['region'])) {
|
if ( ! isset($cache['region'])) {
|
||||||
$cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)) . '__' . $fieldName;
|
$cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)) . '__' . $fieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->associationMappings[$fieldName]['cache'] = $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user