Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-19 Thread Larry Garfield
On Fri, Jan 19, 2024, at 9:47 AM, Lynn wrote: > On Fri, Jan 19, 2024 at 1:51 AM Alexander Pravdin > wrote: > >> I would also suggest supporting readonly classes and creating special >> attributes to help map data fields to constructor arguments. Something like >> this: >> >> readonly class User {

Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-19 Thread php
Hi Alexander, I would also suggest supporting readonly classes and creating special attributes to help map data fields to constructor arguments. Something like this: readonly class User { public function __construct( #[PDOField('user_id')] public string $userId, #

Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-19 Thread php
Hi Saki, Welcome to the internal mailing list! I had looked the pull request, and I'm pleased to have received your email promptly. Thank you! 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 ar

Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-19 Thread Lynn
On Fri, Jan 19, 2024 at 1:51 AM Alexander Pravdin wrote: > I would also suggest supporting readonly classes and creating special > attributes to help map data fields to constructor arguments. Something like > this: > > readonly class User { > public function __construct( > #[PDOField

Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-18 Thread Alexander Pravdin
I would also suggest supporting readonly classes and creating special attributes to help map data fields to constructor arguments. Something like this: readonly class User { public function __construct( #[PDOField('user_id')] public string $userId, #[PDOField('user_nam

Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-18 Thread Saki Takamachi
Hi Frederik > First off, please excuse me if I’ve done something wrong related to 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

Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-18 Thread php
On 2024-01-18 21:23, Niels Dossche wrote: Hi Frederik Just putting the link here so people find it more easily :-) https://github.com/php/php-src/issues/13174 Cheers Niels Thank you, the link was originally on the text "on GitHub" but it seems to have been stripped. -- PHP Internals - PHP

Re: [PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-18 Thread Niels Dossche
Hi Frederik On 18/01/2024 21:21, Frederik van der Els wrote: > Hi internals, > > First off, please excuse me if I’ve done something wrong related to the usage > of the mailing list. This all is completely new to me. > > I hereby want to propose a new fetch mode for PDO. I’ve detailed the > mot

[PHP-DEV] `PDO::FETCH_CONSTRUCTOR` fetch mode proposal

2024-01-18 Thread Frederik van der Els
Hi internals, First off, please excuse me if I’ve done something wrong related to the usage of the mailing list. This all is completely new to me. I hereby want to propose a new fetch mode for PDO. I’ve detailed the motivation for it on GitHub. I haven’t actually written the code for it, but it