| @@ 506-517 (lines=12) @@ | ||
| 503 | * |
|
| 504 | * @return Mapping\CacheMetadata |
|
| 505 | */ |
|
| 506 | private function convertCacheAnnotationToCacheMetadata( |
|
| 507 | Annotation\Cache $cacheAnnot, |
|
| 508 | Mapping\ClassMetadata $metadata, |
|
| 509 | $fieldName = null |
|
| 510 | ) |
|
| 511 | { |
|
| 512 | $usage = constant(sprintf('%s::%s', Mapping\CacheUsage::class, $cacheAnnot->usage)); |
|
| 513 | $baseRegion = strtolower(str_replace('\\', '_', $metadata->getRootClassName())); |
|
| 514 | $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : ''); |
|
| 515 | ||
| 516 | return new Mapping\CacheMetadata($usage, $cacheAnnot->region ?: $defaultRegion); |
|
| 517 | } |
|
| 518 | ||
| 519 | /** |
|
| 520 | * @param \ReflectionProperty $reflectionProperty |
|
| @@ 1204-1217 (lines=14) @@ | ||
| 1201 | * |
|
| 1202 | * @return Mapping\CacheMetadata |
|
| 1203 | */ |
|
| 1204 | private function convertCacheAnnotationToCacheMetadata( |
|
| 1205 | Annotation\Cache $cacheAnnot, |
|
| 1206 | Mapping\ClassMetadata $metadata, |
|
| 1207 | $fieldName = null |
|
| 1208 | ) : Mapping\CacheMetadata |
|
| 1209 | { |
|
| 1210 | $baseRegion = strtolower(str_replace('\\', '_', $metadata->getRootClassName())); |
|
| 1211 | $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : ''); |
|
| 1212 | ||
| 1213 | $usage = constant(sprintf('%s::%s', Mapping\CacheUsage::class, $cacheAnnot->usage)); |
|
| 1214 | $region = $cacheAnnot->region ?: $defaultRegion; |
|
| 1215 | ||
| 1216 | return new Mapping\CacheMetadata($usage, $region); |
|
| 1217 | } |
|
| 1218 | ||
| 1219 | /** |
|
| 1220 | * Attempts to resolve the cascade modes. |
|