probably not fair to pick the concrete example of routing, but:

you could use the DynamicRouter and write a route repository that
triggers the "RoutesCollect" (what you call "info") event and then the
"RoutesAlter" event.

btw, i think lukas smith is pushing for an "alter" cicle in the DI
loading, so that bundles can better share configuration with each other.

cheers,david

Am 07.11.2012 08:36, schrieb Larry Garfield:
> In Drupal, we have two common patterns called "info hooks" and "alter
> hooks".  In a nutshell, we call a hook (think procedural events) that
> all modules may implement, where each module returns a big keyed nested
> array of data, usually definition data of some sort.  That definition
> array is then combined, and passed to another "alter" hook by reference
> so that other modules may poke at, examine, and modify the array.
> 
> I am pushing to switch many of our hooks over to Symfony Events, as we
> are already using events in a number of areas now and they are
> inherently more testable.  However, this "info and alter" pattern is one
> we need to retain in some form.  As an example, we are now using Symfony
> Route objects defined by modules.  Modules will be able to define routes
> using YAML, but once we build that RouteCollection we still need to pass
> those routes to other modules for tweaking.  We also need an event to
> allow modules to define routes at runtime (well, at rebuild time anyway)
> based on user configuration.
> 
> Does a pattern like this exist in the Symfony universe?  Is there some
> existing best practice we can leverage and/or model on that would be
> familiar to Symfonians, or at the very least some known pitfalls or
> stupid ideas for us to avoid?
> 
> My first cut attempt at that is available in this patch:
> 
> http://drupal.org/node/1801570#comment-6691680
> 
> One of the other reviewers commented that passing an empty route
> collection to an event to get filled seems weird, and I agree, but I am
> not sure what the more proper way of doing that is.  Hence the question.
> 
> We do enough of this "info and alter" logic that it would be great to
> generalize to make it easier and more consistent using Events and
> objects, the way we have it fairly well nailed down for hooks and
> arrays.  I am seeking advise on the best way to do that.
> 
> Thoughts?
> 
> --Larry Garfield
> 

-- 
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to