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,
        #[PDOField('user_name')]
        public string $userName,
        #[PDOField('user_address')]
public ?string $userAddress = '', // Optional field with default
value
    );
}

When the constructor is used to create the class, readonly classes should be automatically supported by this new fetch mode right? And indeed, it would be useful to use named parameters if available. I overlooked this possibility in
my response to Saki.

Kind regards,


Frederik van der Els

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to