Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46084 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93968 invoked from network); 18 Nov 2009 17:18:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2009 17:18:01 -0000 Authentication-Results: pb1.pair.com header.from=robert@typo3.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@typo3.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain typo3.org from 217.72.131.73 cause and error) X-PHP-List-Original-Sender: robert@typo3.org X-Host-Fingerprint: 217.72.131.73 mail.elios.de Linux 2.6 Received: from [217.72.131.73] ([217.72.131.73:48694] helo=mail.elios.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/8E-16241-74C240B4 for ; Wed, 18 Nov 2009 12:18:01 -0500 Received: from [192.168.178.31] (p548CCADA.dip.t-dialin.net [84.140.202.218]) by mail.elios.de (Postfix) with ESMTP id 8FFE81FE8203 for ; Wed, 18 Nov 2009 18:16:09 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) In-Reply-To: <010DBFFB-DC99-4E1B-8597-BA18BD8C800E@gmail.com> Date: Wed, 18 Nov 2009 18:17:55 +0100 Content-Transfer-Encoding: quoted-printable Message-ID: <4DA04340-80BE-4A59-B026-3124744A1CAE@typo3.org> References: <010DBFFB-DC99-4E1B-8597-BA18BD8C800E@gmail.com> To: internals@lists.php.net X-Mailer: Apple Mail (2.1077) Subject: Re: [PHP-DEV] RFC: Custom Factories (SPL) From: robert@typo3.org (Robert Lemke) 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 =3D new Email(); // or even instantiate by interface name (the = factory needs to find the right implementation): $email =3D new EmailInterface(); } } So in the end the custom factory needs to find an appropriate = implementation for EmailInterface. Cheers, robert --=20 Robert Lemke Fluent Code Artisan http://typo3.org http://flow3.typo3.org