Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100067 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25410 invoked from network); 28 Jul 2017 06:41:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2017 06:41:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=newaltgroup@bk.ru; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=newaltgroup@bk.ru; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bk.ru designates 94.100.179.251 as permitted sender) X-PHP-List-Original-Sender: newaltgroup@bk.ru X-Host-Fingerprint: 94.100.179.251 smtp20.mail.ru Received: from [94.100.179.251] ([94.100.179.251:41182] helo=smtp20.mail.ru) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/61-32841-B7CDA795 for ; Fri, 28 Jul 2017 02:41:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bk.ru; s=mail; h=To:Date:Message-Id:Subject:Mime-Version:Content-Type:From; bh=IarJ7znKDeR8q/GDlmYWvLJ/T3Km9oKHmiOUOsLJ8Qs=; b=NVgHofWoj/f57oHxJ1VAY/B39Py8sE0YnzF2NbWRNM6ri+yFc8ipZiidq3VlypnLEQd75hDCfkZlsWcoqC1ND4WFSTeEUFpA/GU12zwG5AZ7NGIwpvAoCZrczYfyh69EV+KBaXAQbdymmrCh7IPb9dpglETL5hqiNzheWbCKMSw=; Received: by smtp20.mail.ru with esmtpa (envelope-from ) id 1dayxE-0006H1-M5 for internals@lists.php.net; Fri, 28 Jul 2017 09:40:57 +0300 Content-Type: multipart/alternative; boundary="Apple-Mail=_9382D87E-0FAF-4595-8412-2FFA06CEC3B7" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Message-ID: <1907EFF3-ED77-4F5C-85AA-CDFE323369C5@bk.ru> Date: Fri, 28 Jul 2017 09:40:58 +0300 To: internals@lists.php.net X-Mailer: Apple Mail (2.3273) Authentication-Results: smtp20.mail.ru; auth=pass smtp.auth=newaltgroup@bk.ru smtp.mailfrom=newaltgroup@bk.ru X-7FA49CB5: 0D63561A33F958A56965F243220AC86CCA01A42BFCD234F55A7DD444B16A6A7C725E5C173C3A84C3DB8B71E42BA00C4F08F6779F6C1F1F03E5B2F3A2B87CD4C8C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F9A3D58A9A349F5073B503F486389A921A5CC5B56E945C8DA X-Mailru-Sender: 5359E0D685F10627A37960CE4991768153F45CCCE90E5B527DF125A05A45F650502AACE705B7FED518C1F6AB3FBD83F13DDE9B364B0DF289B1C9E140B68917A5027D9DD7AE851095AE208404248635DF X-Mras: OK Subject: [Request][Discussion] Introduce interfaces PDOInterface and PDOStatementInterface From: newaltgroup@bk.ru (Andrew Nester) --Apple-Mail=_9382D87E-0FAF-4595-8412-2FFA06CEC3B7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello! I=E2=80=99ve been working on request introduced here = https://bugs.php.net/bug.php?id=3D74957 = related to implementing new = PDOInterface and PDOStatementInterfaces. At this point of time classes PDO and PDOStatement do not implement any = interfaces that=E2=80=99s why code that uses PDO and PDOStatement are = coupled and referred to concrete implementation , not interface. It will help to add some custom classes and behavior to these classes = and to decouple caller from details of PDO layer implementations. At this point of time, the only way to add some custom classes and = behavior is to approach this is by subclassing PDO and PDOStatement.=20 You can use the PDO:: ATTR_STATEMENT_CLASS driver option to tell a PDO = object which PDOStatement subclass to return from PDO::prepare(). But this is is not very straightforward and elegant (in terms of coding) = way to do this. But if PDO and PDOStatement implemented interfaces, it would be possible = for the custom behaviour classes to implement those interfaces as well, = making them interchangeable.=20 No changes needed in callers of PDO/PDOStatement. Here is my PR introducing this interface https://github.com/php/php-src/pull/2657 = I would like to hear any feedback on it! Thanks!= --Apple-Mail=_9382D87E-0FAF-4595-8412-2FFA06CEC3B7--