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. :-)
Comments
Comment #1
tim.plunkettSure. Let's do them all I guess.
Comment #2
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|FALSEComment #5
berdirMaybe NULL instead of FALSE?
Comment #6
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|nullAnd 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_granularityis 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
pushpinderchauhan 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 commentedComment #18
andypostFiled follow-up #2346857: Set default property bundle_entity_type in EntityType to NULL