Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently, Drupal\Core\Entity\EntityType has these three methods:
public function isStaticallyCacheable() {
return isset($this->static_cache) ? $this->static_cache: TRUE;
}
public function isRenderCacheable() {
return isset($this->render_cache) ? $this->render_cache: TRUE;
}
public function isFieldDataCacheable() {
return isset($this->field_cache) ? $this->field_cache: TRUE;
}
The isset() is necessary because the properties in question are set to NULL by default. However, that's silly. It's way better to just set $static_cache, $render_cache, and $field_cache to TRUE by default in their definitions, then return the properties directly in these methods.
Let's do that. :-)
Comment | File | Size | Author |
---|---|---|---|
#12 | entity-type-2302235-12.patch | 10.52 KB | er.pushpinderrana |
#12 | interdiff-2302235-10-12.txt | 1.31 KB | er.pushpinderrana |
#1 | entity-type-2302235-1.patch | 6.16 KB | tim.plunkett |
#8 | entity-type-2302235-8.patch | 6.2 KB | l0ke |
#10 | interdiff-2302235-8-10.txt | 5.91 KB | l0ke |
Comments
Comment #1
tim.plunkettSure. Let's do them all I guess.
Comment #2
Crell CreditAttribution: Crell commentedHey, you're not a novice! :-P
Comment #3
tim.plunkettWhoops, sorry :\
I just jumped at the EntityType part.
Comment #4
alexpott(optional) is weird
@var string and then a default of FALSE :)
@var string and a value of FALSE
@var string and default of FALSE
I think we should be doing
@var string|FALSE
Comment #5
BerdirMaybe NULL instead of FALSE?
Comment #6
Crell CreditAttribution: Crell commentedFor uri_callback, callable|null. Strings are only one of many callables. (Arrays are also callables, in the right circumstances, plus closures.)
Also, why are all of these properties snake_cased? Properties should be lowerCamel.
Comment #7
tim.plunkettThey're snake_case because they come from annotations.
Comment #8
l0keChanged according to review.
Comment #9
alexpottDoesn't look like this is ever a bool - needs checking though.
@var string|null
@var callable|null
And we also need to check the documentation on the interface for all the methods...
Is now wrong...
Comment #10
l0keThanks for review @alexpott. To the fist, I didn't find any references where
$permission_granularity
is bool.A new patch and interdiff, considering your notes.
Comment #11
penyaskitoWe should adjust this comments in one line (looks like they should fit). If needed, a break should be just after the last word before the 80 chars limit.
Comment #12
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedJust fixed doc comments as @penyaskito mentioned above, in this patch. Please review.
Comment #13
penyaskitoGreat, thanks!
Comment #14
alexpottCommitted 2d03e83 and pushed to 8.0.x. Thanks!
Comment #16
m1r1k CreditAttribution: m1r1k commentedComment #18
andypostFiled follow-up #2346857: Set default property bundle_entity_type in EntityType to NULL