My first message is probably lacking a higher level description.
So the goal is:
1. To be able to use resource overriding in <app>/Resources folder as
this is currently the case in <Bunlde>/Resource folders,
2. To get the resource (from either <app> or <Bundle>) in a single
call.

One downside I forgot to mention:

With the proposed implementation, files must be located under a
Resources folder inside <app>/Resources/<Bundle>
i.e. <app>/Resources/<Bundle>/Resources/...

I don't see this as an issue and there are probably means to change
this if needed.

@stof:

1. @Child could use (PaR) if the template is not overridden by the
children (either in the bundle or app folder).
2. Actually locateResource('@Child...') and
locateResource('@Parent...') should return the same file, this is how
you can override a resource.




On 29 mar, 19:34, Christophe COEVOET <[email protected]> wrote:
> Le 29/03/2011 19:19, Victor Berchet a crit :
>
>
>
>
>
>
>
> > The simplest way to understand my point is to start by explaining the
> > target behavior.
>
> > As my reflexion started with templates in mind, let's take this as an
> > example:
>
> > Given a ChildBundle<  ParentBundle, the template files would be:
>
> > - ChildBundle/Resources/views/tpl.html.twig (ChB)
> > - ParentBundle/Resources/views/tpl.html.twig (PaB)
>
> > In an ideal world [1]:
>
> > - locateResource('@Child/Resources/views/tpl.html.twig') should return
> > (ChB)
> > - locateResource('@Parent/Resources/views/tpl.html.twig') should
> > return (ChB)
>
> > Now let's override the template in the app Resources folder:
>
> > -<app>/Resources/Child/Resources/views/tpl.html.twig (ChR) [2]
>
> > The behavior I would like to achieve is that:
>
> > - locateResource('@Child/Resources/views/tpl.html.twig', '<app>/
> > Resources') should return (ChR)
> > - locateResource('@Parent/Resources/views/tpl.html.twig', '<app>/
> > Resources') should return (ChR)
>
> > Q1: Do you think this makes sense ? [3]
>
> This makes sense IMO.> Let's assume it makes sense, then comes an other 
> question:
>
> > If we override the template from the parent Bundle:
>
> > -<app>/Resources/Parent/Resources/views/tpl.html.twig (PaR)
>
> > What should be the result of locateResource('@Child/Resources/views/
> > tpl.html.twig', '<app>/Resources', false) ?
> > A. [ChR, PaR, ChB, PaB]
> > B. [ChR, ChB, PaR, PaB]
>
> Locating the template @Child should never used PaR as PaR is not meant
> to override a template from the ChildBundle but from ParentBundle
> (called using @Parent)
>
> But PaR should be used when locating @Parent. And in this case the
> question is who wins ? app/Resources/Parent/... or ChildBundle/Resources/...
> I would think that the app/Resources template wins as this is a template
> set by the end-user for his app.
>
>
>
>
>
>
>
>
>
> > The question would make more sense if you don't have (ChR) then
> > locateResource(..., ..., true) would return:
> > A. (PaR)
> > B. (ChB)
>
> > Q2: What would be the best order for files returned by
> > locateResource() ?
> > A. Resources first, then Bundles,
> > B. Resources and Bundles interlaced
>
> > Before going further I would like to get you POV on Q1 and Q2.
>
> > Thanks,
> > Victor
>
> > [1]
> > "ideal world" because this is not the case today, by my fault I must
> > admit, see
> >https://github.com/symfony/symfony/commit/788f63d460bdb2260f008d86cc0...
> > This is something that need to be fixed.
>
> > [2]
> > I have submitted a PR because I think ChildBundle would be more
> > appropriate than Child here, see:
> >https://github.com/symfony/symfony/pull/416
>
> > [3]
> > There is no way this can be achieved with the current code.
> > You would need to call:
> > locateResource('@Child/Resources/Resources/views/tpl.html.twig',
> > '<app>/Resources')
> > to get (ChR)
> > and locateResource('@Parent/Resources/Resources/views/tpl.html.twig',
> > '<app>/Resources')
> > would return an InvalidArgumentException 'Unable to find file".
>
> > Some more notes:
> > - To me, B makes more sense for Q2,
> > - I have a proto working which could be ready very soon if we choose
> > to go in this direction.
>
> --
> Christophe | Stof

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to