Hi Alexey,

Am 18.11.2009 um 17:27 schrieb Alexey Zakhlestin:

> So, from the high-level point of view, you want to introduce mechanism, which 
> would allow instantiate objects by their interface, instead of their 
> class-name.
> And this mechanism should use user-provided rules for choosing appropriate 
> implementation.


well, using interface was just an example, we'd need the ability to instantiate 
classes as well by custom factories. I tried to clarify this by an updated 
example:

class Foo {
        public function bar() {
                        // Instantiate by class name:
                $email = new Email();
                        // or even instantiate by interface name (the factory 
needs to find the right implementation):
                $email = new EmailInterface();
        }
}

So in the end the custom factory needs to find an appropriate implementation 
for EmailInterface.

Cheers,
robert

-- 
Robert Lemke
Fluent Code Artisan

http://typo3.org
http://flow3.typo3.org


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to