Closed (fixed)
Project:
Flag
Version:
8.x-4.x-dev
Component:
Flag core
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Sep 2015 at 12:47 UTC
Updated:
2 Oct 2015 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
giancarlosotelo commentedMoving the lazy builder to a service.
Comment #3
martin107 commentedCan I suggest a better home for the function.
Looking at the FlagService methods, each operates directly on a Flag
getFlagByXYX()
getFlaggingXYX()
flag()/unflag()
and I think this new method looks a little out of place.
Would a better location for the lazyLinkBuilder() be as a method on another one of our services.
plugin.manager.flag.linktype
\Drupal\flag\ActionLinkPluginManager
I can see one minor objection ...it might look strange to have to pass in the entity manager, which we would have to do, into something advertised as a PliginManager...
Comment #4
giancarlosotelo commentedOk it seems a bit strange but I also think it is a better place for the lazyLinkBuilder().
Comment #5
joachim commentedHmm yeah I'm not convinced of it on the plugin manager either. The plugin manager's job is pretty much just to serve up a plugin when you want one.
I also see @martin107's point that there's a tendency to use FlagService as a dumping ground for everything.
I'll have a ponder...
Comment #6
martin107 commentedGiancarlo, I apologies .. now that I look at now that I look at #4.
I think it is better that moving things into FlagService ... but it does look very out of place.
I personally am not opposed to having a service with only one method in it.
By way of making up for the bad advice .. I will do the work for the next patch .. I will try and get to this tonight.
Comment #7
martin107 commentedI have moved the function into a LazyLinkBuilder service.
Comment #8
socketwench commentedI'd go for a new service first, and the link plugin manager second. It's not like there isn't precedence in core for this -- CommentDefaultFormatter is a field formatter service also tasked with lazy-building.
"LazyLinkBuilder" service works as a name, although I'd prefer something a little more Flag specific and a little less task specific. "FlagLinkBuilder"?
Comment #9
martin107 commentedThanks for the nudge ... FlagLinkBuilder looks better.
Comment #10
giancarlosotelo commented#6 no worries I am just learning and making patches helps me a lot. So I am happy to collaborate in anyway.
Comment #11
socketwench commentedLooks good to go.
Comment #12
joachim commentedCommitted, with the class and interface docblock summaries tweaked.