Issue #3252278: Computed entity reference fields cannot express cacheable metadata
3 unresolved threads
Merge request reports
Activity
added 1 commit
- 0f54eb66 - Conditional on cacheable dependency interface
added 75 commits
-
0f54eb66...47958e79 - 70 commits from branch
project:9.4.x
- c41f971c - Allow ER fields to express cacheable metadata on properties.
- 62a31f5a - Fix broken copypasta
- f0037520 - Don't revert recent work... oof
- 43cff7ae - Conditional on cacheable dependency interface
- 4abb03cd - Update for handling of empty items and only add cacheability if interface exists.
Toggle commit list-
0f54eb66...47958e79 - 70 commits from branch
added 1 commit
- 323bb165 - Filtered field items object is still an object.
1 <?php 2 3 namespace Drupal\Core\Field; 4 5 use Drupal\Core\Cache\CacheableMetadata; 6 7 /** 8 * Interface for field item lists which have cacheable metadata for empty state. 9 * 10 * Field item lists should implement this interface when their being empty 11 * results from a condition with cacheability distinct from its parent. For 12 * instance, computed fields may change their value due to entity CRUD events 13 * orthogonal to the parent entity itself. Non-empty lists would continue to 14 * yield cacheable metadata (e.g., during serialization) via their items. 15 */ 16 interface EmptyFieldItemListCacheabilityInterface { 393 393 * @return string 394 394 * The property name which has an entity as its value. 395 395 */ 396 protected static function getDataReferencePropertyName(EntityReferenceItem $item) { 396 public static function getDataReferencePropertyName(EntityReferenceItem $item) { 35 37 $normalized_items = $this->normalizeFieldItems($field, $format, $context); 36 38 assert($context['resource_object'] instanceof ResourceObject); 37 39 return $context['resource_object']->getResourceType()->getFieldByInternalName($field->getName())->hasOne() 38 ? array_shift($normalized_items) ?: CacheableNormalization::permanent(NULL) 40 ? array_shift($normalized_items) 41 ?: new CacheableNormalization( 42 $field instanceof EmptyFieldItemListCacheabilityInterface 43 ? $field->getEmptyListCacheability() 44 : new CacheableMetadata(), 45 NULL 46 ) added 4382 commits
- 323bb165...655cb760 - 4372 earlier commits
- 01da0fd9 - Issue #3371937 by yash.rode, Abhijith S, smustgrave, fgm: Theme declaration...
- 7b1d78a7 - Issue #3446577 by mondrake: Prepare test docblocks for annotation conversion to attributes
- de44e097 - Issue #3446962 by kim.pepper: Remove incorrectly added...
- 825985c4 - Allow ER fields to express cacheable metadata on properties.
- e32f7cf8 - Fix broken copypasta
- 2f206c12 - Don't revert recent work... oof
- 786e6b28 - Conditional on cacheable dependency interface
- 684b8f75 - Update for handling of empty items and only add cacheability if interface exists.
- e59931ed - CS fix
- 99473fc6 - Filtered field items object is still an object.
Toggle commit list
Please register or sign in to reply