Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100134 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95209 invoked from network); 31 Jul 2017 11:49:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2017 11:49:49 -0000 Authentication-Results: pb1.pair.com header.from=newaltgroup@bk.ru; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=newaltgroup@bk.ru; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bk.ru designates 94.100.177.101 as permitted sender) X-PHP-List-Original-Sender: newaltgroup@bk.ru X-Host-Fingerprint: 94.100.177.101 smtp41.i.mail.ru Received: from [94.100.177.101] ([94.100.177.101:34840] helo=smtp41.i.mail.ru) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FC/CB-07025-A591F795 for ; Mon, 31 Jul 2017 07:49:48 -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=CE0cyIP00SYJw3Hvi5xpakYfg7pJ8TzbKNuP70xOgEs=; b=LDZ+HwAqpGujn++QKMEfVexS4G7Buslm06hX+d6vQYYPvJIq6XDZv6hZAx3McXgpgnGo1uInwRAOK/jIqy/M5aEryqV1l28Ul0Ws7G7hJOCXU2oLC5CWEHz6xa+CCpM9fkWRD0NX7Il3oGTwOaP76kWl9GvktMyYDw1JBAJT6L8=; Received: by smtp41.i.mail.ru with esmtpa (envelope-from ) id 1dc9Cf-0007zZ-G0; Mon, 31 Jul 2017 14:49:41 +0300 Message-ID: <2A653728-97CA-4AA5-BA30-5BF26FABBC2A@bk.ru> Content-Type: multipart/alternative; boundary="Apple-Mail=_467DA5B1-CEFC-4634-ABD0-E5DA541A8097" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Mon, 31 Jul 2017 14:49:37 +0300 In-Reply-To: Cc: "internals@lists.php.net" To: Dan Ackroyd References: <1907EFF3-ED77-4F5C-85AA-CDFE323369C5@bk.ru> <880CDC06-17D6-4E40-8A48-F2E1CB405667@bk.ru> X-Mailer: Apple Mail (2.3273) Authentication-Results: smtp41.i.mail.ru; auth=pass smtp.auth=newaltgroup@bk.ru smtp.mailfrom=newaltgroup@bk.ru X-7FA49CB5: 0D63561A33F958A5D1E999565580B38F530C5D7D9AAFA913217008430311E817725E5C173C3A84C37727919777A35F2B70E598C6475D63A5BCC85A7874001769C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0F05F538519369F3743B503F486389A921A5CC5B56E945C8DA X-Mailru-Sender: 5359E0D685F10627A37960CE499176817072AF965F2DE8AD7D4C16695326C44E17E9FC81D327F02B18C1F6AB3FBD83F13DDE9B364B0DF289B1C9E140B68917A5027D9DD7AE851095AE208404248635DF X-Mras: OK Subject: Re: [PHP-DEV] [Request][Discussion] Introduce interfaces PDOInterface and PDOStatementInterface From: newaltgroup@bk.ru (Andrew Nester) --Apple-Mail=_467DA5B1-CEFC-4634-ABD0-E5DA541A8097 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 That=E2=80=99s actually the thing that you can=E2=80=99t use = PDO::ATTR_STATEMENT_CLASS with persistent PDO. To make it possible to have persistent PDO with custom PDOStatement you = should have: 1) custom `CustomPDO implements PDOInterface` which will be somewhat = proxy to PDO instance 2) custom `CustomPDOStatement implements PDOStatementInterface` which = will be returned from CustomPDO::prepare and will have our additional = logic + some stuff for persistence. And in our userland code we can have type hints like = `someMethod(PDOInterface $pdo)` or `someMethod(PDOStatementInterface = $stmt)`=20 I hope it explains a bit how interfaces could help here. > On Jul 31, 2017, at 2:17 PM, Dan Ackroyd = wrote: >=20 > On 31 July 2017 at 08:21, Andrew Nester wrote: >>=20 >> when we are using persistent PDO we can=E2=80=99t use = PDO::ATTR_STATEMENT_CLASS and >> return our custom PDOStatement class >>=20 >> But just implementing PDOInterface and PDOStatementInterface will = allow us to implement >> this and have proper type hints in userland code. >=20 > Are you sure having interfaces would change this? >=20 > I would assume you can't use PDO::ATTR_STATEMENT_CLASS with persistent > PDO due to a limitation of the implementation internal to PDO, rather > than anything to do with what sub-classes what. >=20 > Could you post a working example of being able to set > PDO::ATTR_STATEMENT_CLASS with persistent PDO? >=20 > cheers > Dan --Apple-Mail=_467DA5B1-CEFC-4634-ABD0-E5DA541A8097--