I did some research and found that determining whether a module is
enabled or not is the work of the controller classes.  Here are the
step if you want to implement some complex logic that you don 't want
to put in your project configuration class.  The more simpler method
of Johannes is preferred if that works for you and that 's for you to
determine.

1. edit the factories.yml to use your own controller class
2. implement this controller class that extends the
sfFrontWebController class by overriding the 'controllerExists' of one
of it 's parent classes sfController
3. override the 'controllerExists' protected method of the parent
sfController class.  Just copying the content of the method and adding
another method that adds enabled modules using a database should be
enough


On Aug 13, 5:04 pm, Johannes <johannes.schmitt...@googlemail.com>
wrote:
> No explicit method as far as I know, but this works:
>
> sfConfig::set('sf_enabled_modules',
> array_unique(array_merge(sfConfig::get('sf_enabled_modules'),
> array('my_first_module_name_to_enable', 'my_second_module', 'etc'))));
>
> Kind regards,
> Johannes
>
> On 13 Aug., 14:57, Gustavo Adrian <comfortablynum...@gmail.com> wrote:
>
> > Hi James. I was thinking and something like that too. What I don't know is
> > how to enable the modules of the plugin programmatically. Is there available
> > a method for this purpose?
>
> > Thanks!
>
> > On Fri, Aug 13, 2010 at 3:37 AM, James Cauwelier
> > <james.cauwel...@gmail.com>wrote:
>
> > > It is possible to enable a plugin from the projectConfiguration
> > > methods, but nobody dictates that the plugin names should be hardcoded
> > > there, you could use a configuration XML for instance...
>
> > > The code below does not work, but illustrates the principle.  There is
> > > also more than one way to do this.  You don 't have to use XML and
> > > could use a database or any other kind of storage.  Doctrine is also
> > > packaged as a plugin, so it probably is not possible to use doctrine
> > > for this.
>
> > > public function setup()
> > >  {
> > >    if (file_exists('enablePlugins.xml')) {
> > >        $xml = simplexml_load_file('enablePlugins.xml');
> > >        $enabledPluginsXml = $xml->xpath(...);
> > >        $this->enablePlugins($enabledPluginsXml);
> > >     }
> > >  }
>
> > > On 12 aug, 22:12, Gustavo Adrian <comfortablynum...@gmail.com> wrote:
> > > > Hi, first of all, thank you both guys for your answers.
>
> > > > @Damon: I couldn't try that yet but, as you said, the only problem I see
> > > is
> > > > that I have no way (that I know) of enable the plugin on
> > > > ProjectConfiguration class. And this class is used on the very first 
> > > > part
> > > of
> > > > the framework initialization. I need this because I need a way to 
> > > > install
> > > (a
> > > > kind of) plugins from my backend to extend a CMS I'm developing and, if 
> > > > I
> > > > could use the plugin functionality that Symfony already has, it would be
> > > > great. If I can't, then I'd need to create my own plugin system (which,
> > > as
> > > > you would guess, it can take a long time).
>
> > > > @Stéphane: Could you point me to a place where Symfony use this to look
> > > for
> > > > examples of code? In which way would you use this class for my need?
>
> > > > Thank you both again!
>
> > > > On Thu, Aug 12, 2010 at 4:33 AM, Stéphane <stephane.er...@gmail.com>
> > > wrote:
> > > > > There is a class which helps you "wrapping" methods. Search for
> > > > > sfClassManipulator.
>
> > > > > Cheers,
>
> > > > > Before Printing, Think about Your Environmental Responsibility!
> > > > > Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!
>
> > > > > On Thu, Aug 12, 2010 at 8:07 AM, Damon Jones <damonljo...@gmail.com
> > > >wrote:
>
> > > > >> You can certainly run these tasks from within a task, as described
> > > > >> here:
>
> > > > >>http://www.symfony-project.org/more-with-symfony/1_4/en/13-Leveraging.
> > > ..
>
> > > > >> So, maybe you can create instance of these tasks and run them from
> > > > >> elsewhere in your code.
>
> > > > >> I think the issue would be how you enable them in your
> > > > >> ProjectConfiguration.
>
> > > > >> On Aug 11, 8:49 pm, Gustavo Adrian <comfortablynum...@gmail.com>
> > > > >> wrote:
> > > > >> > Hi!
>
> > > > >> > Quick question: Is there a way to install and enable a plugin from
> > > PHP?
>
> > > > >> > Thanks!
>
> > > > >> --
> > > > >> 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 users" group.
> > > > >> To post to this group, send email to symfony-users@googlegroups.com
> > > > >> To unsubscribe from this group, send email to
> > > > >> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> > > <symfony-users%2bunsubscr...@googlegroups.com<symfony-users%252bunsubscr...@googlegroups.com>
>
> > > > >> 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 users" group.
> > > > > To post to this group, send email to symfony-users@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> > > <symfony-users%2bunsubscr...@googlegroups.com<symfony-users%252bunsubscr...@googlegroups.com>
>
> > > > > 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 users" group.
> > > To post to this group, send email to symfony-users@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> > > 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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to