Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100132 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76095 invoked from network); 31 Jul 2017 07:22:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2017 07:22:00 -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.176.155 as permitted sender) X-PHP-List-Original-Sender: newaltgroup@bk.ru X-Host-Fingerprint: 94.100.176.155 smtp18.mail.ru Received: from [94.100.176.155] ([94.100.176.155:34110] helo=smtp18.mail.ru) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/89-07025-69ADE795 for ; Mon, 31 Jul 2017 03:21:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bk.ru; s=mail; h=References:To:Cc:In-Reply-To:Date:Subject:Mime-Version:Content-Type:Message-Id:From; bh=YNK8WwNpOBJ3KCQOozmZ0mCw6jpVogTYX4pDhg4+I18=; b=tHQw4+CNlQ2AJPlyJfSj5WcmKikPkQGXBIk8Og93LVqQh0fvjKEXg0Q0YhA2MwqmNWewHoqyLO6G8ZR0ajSn+qhip6SpBrL38APm0/1PlDFLt03ys2lSsh9vENeyO8AZZtehjFRVXNb0QmwoI4JH5501HtkZD0dcRvfdPCiMCEc=; Received: by smtp18.mail.ru with esmtpa (envelope-from ) id 1dc51X-00087Z-KT; Mon, 31 Jul 2017 10:21:56 +0300 Message-ID: <880CDC06-17D6-4E40-8A48-F2E1CB405667@bk.ru> Content-Type: multipart/alternative; boundary="Apple-Mail=_D7EB3A25-090B-47A6-809F-BE0E4ADDA131" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Mon, 31 Jul 2017 10:21:50 +0300 In-Reply-To: Cc: "internals@lists.php.net" To: Dan Ackroyd References: <1907EFF3-ED77-4F5C-85AA-CDFE323369C5@bk.ru> X-Mailer: Apple Mail (2.3273) Authentication-Results: smtp18.mail.ru; auth=pass smtp.auth=newaltgroup@bk.ru smtp.mailfrom=newaltgroup@bk.ru X-7FA49CB5: 0D63561A33F958A5538DAA530BA638688129B65E39CA4EEBCC62DB440A80506E725E5C173C3A84C37952320C71F5F867A2A716F03ED7880CE5B2F3A2B87CD4C8C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-Mailru-Sender: 5359E0D685F10627A37960CE49917681A42E2270325DFFB74626C73040380C123ED5CD8C54C72B3118C1F6AB3FBD83F13DDE9B364B0DF289B1C9E140B68917A5027D9DD7AE851095AE208404248635DF X-Mras: OK Subject: Re: [PHP-DEV] [Request][Discussion] Introduce interfaces PDOInterface and PDOStatementInterface From: newaltgroup@bk.ru (Andrew Nester) --Apple-Mail=_D7EB3A25-090B-47A6-809F-BE0E4ADDA131 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Yes, sure. Good example has been provided in related issue in bug tracker. Assume we are using persistent PDO and want to handle long running = processes and add some logic when executing queries / connections (for = instance logging). It would require your custom classes deriving from PDO and PDOStatement = where we add this additional logic. According to documentation = (http://php.net/manual/en/pdo.setattribute.php = ) when we are using = persistent PDO we can=E2=80=99t use PDO::ATTR_STATEMENT_CLASS and return = our custom PDOStatement class instance from prepare method. But just implementing PDOInterface and PDOStatementInterface will allow = us to implement this and have proper type hints in userland code. In addition, using interfaces is better from code architecture = perspective (which is just my opinion and a bit arguable of course). Thanks! > On Jul 29, 2017, at 1:13 PM, Dan Ackroyd = wrote: >=20 > On 28 July 2017 at 07:40, Andrew Nester wrote: >> Hello! >>=20 >> the only way to add some custom classes and behavior is to approach = this is by subclassing PDO and PDOStatement. >=20 >=20 > Please could you explicitly say when this is a problem, or what using > an interface allows? >=20 > I can imagine possible scenarios, but the discussion would be clearer > if you gave concrete examples. >=20 > cheers > Dan --Apple-Mail=_D7EB3A25-090B-47A6-809F-BE0E4ADDA131--