That's one solution, certainly, but in the interests of forward
compatibility I'd prefer to use your API - if the use of the register()
method isn't critical I'll ignore it, but I think the component is more
flexible if it allows the specification of those extra
spl_autoload_register() parameters.
Thanks,

Craig

On 7/21/09, Fabien Potencier <[email protected]> wrote:
>
>
> Why not doing something like this?
>
> spl_autoload_register(array(new sfServiceContainerAutoloader(),
> 'autoload'));
>
> Fabien
>
> --
> Fabien Potencier
> Sensio CEO - symfony lead developer
> sensiolabs.com | symfony-project.org | fabien.potencier.org
> Tél: +33 1 40 99 80 80
>
>
> [email protected] wrote:
> > Hello,
> >
> > I'm trying to integrate your dependency injection container into a
> > project. I'd like to use the autoload functionality for convenience,
> > but its implementation is making it difficult for me. It's important
> > that the DI autoloader is considered before my own framework's
> > autoloader because mine is far more strict; I've achieved this with
> > the autoloaders of other libraries (Doctrine's, for instance) by
> > prepending them to the autoload stack
> >
> > spl_autoload_register('Doctrine::autoload', true, true)
> >
> > However I can't do this with the DI container since the registration
> > happens in sfServiceContainerAutoloader::register. Is there any chance
> > the register method could accept parameters to achieve the above?
> > Patch below:
> >
> > Index: lib/sfServiceContainerAutoloader.php
> > ===================================================================
> > --- lib/sfServiceContainerAutoloader.php      (revision 20206)
> > +++ lib/sfServiceContainerAutoloader.php      (working copy)
> > @@ -21,11 +21,14 @@
> >  {
> >    /**
> >     * Registers sfServiceContainerAutoloader as an SPL autoloader.
> > +   *
> > +   * @param boolean $throw False to prevent exceptions being thrown
> > if the class cannot be found
> > +   * @param boolean $prepend True to register the autoloader at the
> > front of the autoload stack
> >     */
> > -  static public function register()
> > +  static public function register($throw = true, $prepend = false)
> >    {
> >      ini_set('unserialize_callback_func', 'spl_autoload_call');
> > -    spl_autoload_register(array(new self, 'autoload'));
> > +    spl_autoload_register(array(new self, 'autoload'), $throw,
> > $prepend);
> >    }
> >
> >    /**
> >
> > Thanks,
> > Craig
> >
> > >
> >
>
>
> >
>

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