[Solar-talk] Solar_Event_Dispatcher (was: tests in the browser)

Paul M Jones pmjones at solarphp.com
Wed Sep 20 11:55:36 PDT 2006


On Sep 20, 2006, at 1:48 PM, Rodrigo Moraes wrote:

> On 9/20/06, Andrew Shell wrote:
>> Great job!  One thing I was thinking about was if the Solar version
>> needs the getInstance logic because we have the registry to store  
>> stuff
>> like this in.
>
> I stayed for a while thinking in how to make the singleton in a Solar
> way. Solar has very few singletons (Solar itself and the new
> Solar_Request also acts as one, because of the static properties). I
> haven't tried the registry, and indeed, that would be a more Solar
> way.

Just to let you in on my thought process:  eventually, Solar_Request  
won't be a singleton either.  I needed a way to go from Solar::get()  
to $request->get() easily, and using static vars was the easiest  
way.  But in a future version I'll make it so classes that need  
access to a Solar_Request object will do so via dependency injection;  
that will de-couple things even more, and make testing easier too.



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list