Stof,
About Q2 and what template should win:
If we have:
- ChildBundle/Resources/views/tpl.html.twig (ChB)
- ParentBundle/Resources/views/tpl.html.twig (PaB)
- <app>/Resources/Parent/Resources/views/tpl.html.twig (PaR)
locateResource('@Parent/Resources/views/tpl.html.twig', '<app>/
Resources') should better return:
A. (ChB) according to my first messgae
B. (PaR) according to your first reply
I think that both A and B make sense:
A. If a resource is overridden by a child Bundle you probably want to
use the resource from the child Bundle,
B. If you have specifically overridden a resource you probably have
good reasons for that and you want to use it.
but both have some cons:
A. You lose any specific modification done in your <app>/Resources
folders,
B. You lose the modification done in the ChildBundle
The right solution would be to create an <app>/Resources/Child/
Resources/views/tpl.html.twig (ChR)
So an idea could be to throw an exception "Hidden resource" when a
resource in the <app> folder is overridden by a resource in a derived
bundle.
i.e. "The resource (PaR) is hidden by a resource located in a derived
bundle (ChB). You need to create a (ChR) file in order to override
(ChB)"
What do you think ?
Cheers,
Victor
On Mar 29, 8:45 pm, Victor Berchet <[email protected]> wrote:
> stof,
>
> You are absolutely right, sorry for the confusion.
>
> So my first message should be:
>
> What should be the result of locateResource('@Parent/Resources/views/
> tpl.html.twig', '<app>/Resources', false) ?
> A. [ChR, PaR, ChB, PaB]
> B. [ChR, ChB, PaR, PaB]
>
> And the 2 points of my last message are not valid.
>
> Cheers,
> Victor
>
> On Mar 29, 8:14 pm, Christophe COEVOET <[email protected]> wrote:
>
>
>
>
>
>
>
> > Le 29/03/2011 19:52, Victor Berchet a crit :
>
> > > 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.
>
> > No. @Child should not return a template coming from the ParentBundle as
> > you are explicitly asking for a template of the ChildBundle.
>
> > The inheritance defines ChildBundle as overwriting ParentBundle when
> > asking for @Parent but it does not define ParentBundle as a fallback for
> > all template of ChildBundle which are asked using @Child.
>
> > --
> > 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