Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122182 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9464 invoked from network); 19 Jan 2024 00:05:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Jan 2024 00:05:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1705622756; bh=1wklAoNggrFNbQTW1jVp1mmRQWVW0zTSyedfSZ7PrWE=; h=Subject:From:In-Reply-To:Cc:Date:References:To:From; b=g0HtfwFxmvBsEulQDOnCuVtr+xCN118+DM1ZeK17F8cbz1nb0CFBMNzbrLTZqmdZ0 A4Wk89BRHog5pCmLkFDjch5CE4lS12WM+F4vX+JzckCrm94UTEB/eP7d8BkapHoAVV oKIIjPMykDUgxc6qhZ7rLgHvZgO+z9Nj0QsRGoRhNWvxs8HqqXHq6BIDiCt5sYnhma C+GaeJfAV5EY992obP8C73DDzACIZBkpbBNKB48teYIYpSldWCF1jHaBq5qiI49KuW +JgfUo79/2K5N5Ct1WGg4QV6AylyV/xCjevCEQzoxHg7vnHtuCrXXDFVBIt/Ue3Ej4 V50cTfYCxr7Hg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6F68F18005D for ; Thu, 18 Jan 2024 16:05:54 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 18 Jan 2024 16:05:53 -0800 (PST) Received: from smtpclient.apple (softbank060067217005.bbtec.net [60.67.217.5]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id 1E592401D9; Fri, 19 Jan 2024 09:05:09 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1705622709; bh=1wklAoNggrFNbQTW1jVp1mmRQWVW0zTSyedfSZ7PrWE=; h=Subject:From:In-Reply-To:Cc:Date:References:To:From; b=QRyiMnBIVN8ZFxgU6eNDFuHxMoqmK7lcoruU532daUpDPAz+HHLQgaN465Z4PmQna 45fiNuH4eRjikn/TxmpID7mWgjjbT8DyMGEmj5JRIQCIkldZwpIEG5It2Tbw5g7IuP JMhmrUCpNYB35C+5d4izairFNWMgQvIcwI+YU+5M= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) In-Reply-To: Cc: Niels Dossche , internals@lists.php.net Date: Fri, 19 Jan 2024 09:04:56 +0900 Message-ID: <6246AF4D-C204-443C-9056-F662E59AA687@sakiot.com> References: To: php@xpple.dev X-Mailer: iPhone Mail (21B101) Subject: Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal From: saki@sakiot.com (Saki Takamachi) Hi Frederik > First off, please excuse me if I=E2=80=99ve done something wrong related t= o the usage of the mailing list. This all is completely new to me. Welcome to the internal mailing list! I had looked the pull request, and I'm= pleased to have received your email promptly. > Thank you, the link was originally on the text "on GitHub" but it seems to= have been stripped. Since mailing lists are text rather than HTML, you cannot attach links to st= rings. > I hereby want to propose a new fetch mode for PDO. I=E2=80=99ve detailed t= he motivation for it on GitHub. I haven=E2=80=99t actually written the code f= or it, but it should not be too difficult. Now, I agree that it is often not possible to use `PDO::FETCH_CLASS` because= DB column names are typically snake case and variables and properties are c= amel case. IMHO, passing arguments to the constructor in order is a good approach, but I= think another option would be to give attributes to properties and map data= appropriately when using PDO::FETCH_CLASS. e.g. ``` #[ColumnName('user_name')] private string $userName; ``` In addition to the concerns mentioned in the pull request, I'm also concerne= d that more modes with similar functionality will confuse users. Regards. Saki=