On Mon, Mar 11, 2013 at 4:30 PM, Bas Kamer <[email protected]> wrote: > On 5 mrt. 2013, at 15:29, Matthew Weier O'Phinney <[email protected]> wrote: > >> The logic in canCreateServiceWithName() should similarly be >> very lightweight. > > interesting read. > > Do you see any problems with the following... > > This way you would be able to just slap on an interface on any class and > wouldn't have to maintain the AbstractInterface::$serviceClasses array > > public function canCreateServiceWithName(ServiceLocatorInterface $services, > $name, $requestedName) > { > return in_array("aninterface", class_implements($name)) > }
That makes perfect sense as far as I'm concerned; I showed using an array property just to demonstrate, but the logic can be done any way you want. For things like adapters, where polymorphism is less likely and the creation of the adapter will likely be the same across different implementations, this approach would be quite simple and effective. -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
