Closed (fixed)
Project:
Flag
Version:
8.x-4.x-dev
Component:
Flag core
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Aug 2015 at 09:09 UTC
Updated:
18 Sep 2015 at 10:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
joshi.rohit100Like this or need commenting ?
Comment #3
martin107 commentedThe patch from #2 looks good to me.....
I would like to make a small change to one of the method's variable names.
$flaggable_type seems a better fit when reading :-
Comment #4
joachim commentedLooks good for the approach, though there's a typo or two in the variable names -- flaggble?
Comment #5
martin107 commentedAh I just notice this Flagging::getFlaggableId() is for public access.
We could greatly simplify but just returning
$this->get('entity_id')->entity;
Full disclosure I shamelessly copied this from
\Drupal\comment\Entity\Comment::getCommentedEntity()
I wonder if we have been missing this simplification from other FlagService methods
I will have time to think about this ... only later in the week.
PS we would have to change the BaseDefinitionField definition of entity_id from string to an entity reference.
and in a similar fashion Flagging::getFlag() in turn becomes
public function getFlag() {
+return $this->entityManager()->getStorage('flag')->load($this->getFlagId());
- return $this->get('flag_id')->entity;
}
Comment #6
joshi.rohit100corrected typo.
Comment #7
martin107 commentedI have just remembered lines like
are a valued optimisation, especially useful when operating at scale .....
I think it would be a major change to convert string to entity_refernces...
My instinct is that this design decision maybe a good optimization for D7, but for D8 and its rewrite of the entity system
that assumption needs to be at least challenge and thoroughly profiled in a issue I want to file that issue this weekend. :)
As usual my thoughts come out too slowly ... sorry for the distraction.
the typo fix looks good.
Comment #9
joshi.rohit100Re-rolled
Comment #10
joachim commentedThanks everyone!