Hey all,

since I didn't receive a reply on the users list, I decided to forward
this here. While I addressed Fabien personally, I'd be about all
insights anybody can offer. I'm really just looking to find out
whether this is a problem Symfony should take care of for an
application, or whether it is a problem an application has to solve
itself. I am of course aware that this essentially the diamond
problem, and that PHP does not have multiple inheritance. So I was
hoping you might have some ideas on how to go about implementing such
plugins? What design would you personally go for? Use the event
handler for it all? Something else entirely?

Cheers
Nils


---------- Forwarded message ----------
From: Nils Adermann <[email protected]>
Date: 2010/2/22
Subject: [symfony-users] Re: Symfony 2 and changing a Bundle in the Application
To: symfony users <[email protected]>





On Feb 22, 1:50 pm, Fabien Potencier <fabien.potenc...@symfony-
project.com> wrote:
> On 2/20/10 5:42 PM, Matthias N. wrote:
> > So..  my question is how do I overwrite / change code from a bundle in
> > src/Bundle ?
>
> Just create a bundle with the same name but in the Application/
> directory. And everything is just easier as you can "just" override the
> controllers (same class name but from different namespaces). And for
> templates, we have the exact same inheritance mechanism (just a bit more
> powerful ;)).
>
> By the way, you can create as many namespaces as you need to host your
> bundles. And you can store them wherever you want. You have much more
> flexibility than what you have in symfony 1.
>
> Fabien

Hey Fabien,

what are your thoughts on building an application that allows the user
to install multiple bundles that extend an existing one? How would you
go about having two bundles that each add something to the controller
of an existing bundle?

Of course you could add a Bundles1 and a Bundles2 directory and load
them after one another, but having to hardcode the maximum number of
chained bundles in there seems unclean. Of course you preferably do
not want to chain many anyway to keep things simple, but allowing a
few seems acceptable to me. This was really what I was getting at with
my question about Bundles inside of Bundles question at Symfony Live.
I agree that actual nesting of Bundles inside other Bundles would
overcomplicate things and is not a good idea.

Since I haven't tried that yet, does a Bundle have to explicitly
reference the Bundle it extends, meaning are chains even possible
without the extending bundles knowing about each other?

Let me give you an example: I have my Forum bundle that has a
controller for a topic (view posts, reply, etc). Now if I want to
build a bundle that adds polls to topics I could create a Forum bundle
extending the existing bundle, adding the voting actions etc. to the
controller. I can place this Bundle in Application/. Next I want to
add a print view to topics, so I create another Forum Bundle that adds
the relevant bits. Where do I put this bundle? Can the Poll and Print
view bundles even be used at the same time?

Am I thinking about Bundles all in the wrong way? I'm really not sure
my ideas even make sense. On the other hand you say it is much more
flexible so I hope this is doable somehow?

Cheers
Nils

--
You received this message because you are subscribed to the Google
Groups "symfony users" 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-users?hl=en.

-- 
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