Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91418 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6213 invoked from network); 25 Feb 2016 18:32:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2016 18:32:46 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.51 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.215.51 mail-lf0-f51.google.com Received: from [209.85.215.51] ([209.85.215.51:34376] helo=mail-lf0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/15-11730-CC84FC65 for ; Thu, 25 Feb 2016 13:32:45 -0500 Received: by mail-lf0-f51.google.com with SMTP id j78so38822707lfb.1 for ; Thu, 25 Feb 2016 10:32:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=O/4lUipJMUjNdG+w7AsmSjxUR5Fi5nRyLN06EldI5Wk=; b=gvyFpmY5RIA8/Y2pyyhebDn51eGC/YMUr6DwTemwYNSbS8S+IJoSggaPIo5OqzzNcE VEWI7aV/eTzbmVI2WMqJuCBdIMihC4RwkejA8tWQdmYywjTvsg0IgmLLfh1a22eqq9BS J91G0OQcyJ/vogf0xgCAtDvHSlplTEaNp+HS0jahNwlQEn3Vs8usjwDdy59oC8KAJUMH Rk1+U2BYL1x9txeQFzyqn2OnTB25GzW4sOGkm2d1gzVXgQqU4wjR+R89mrPUrPmwaEnl hxuDfkwnIV8vd55y8TVtkly12nkvIfv/feGHwphz7YXoSymIDmL125wpkY0m3kbxmPCl vouA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=O/4lUipJMUjNdG+w7AsmSjxUR5Fi5nRyLN06EldI5Wk=; b=fiN3J7xcpngDPdwnOxglAR0Ii/Hgx6iU08P3ljtOZp59jepCLTvKuCVNnuHAZMjuaF A6dWZ80NcJev3e897nElS4u4ZIR2OIpXQf/fYRPyC2PhCn/LIpQOdWlgbDMqlfJusJBb eZmRf8BBHH8ph5Sp86anpDTu96hwgkvRo+irp33ip4WKYlCWGk7ZTWwJ1micUT9iV3Ug DFsT32IOgEMYSHOWKSeJua/08T5QFeuatnBCgOKvaUXNKEm8H1px40p2MMhH5MLh0ROo UUZA0BUxGLQrBKFbrfR0mK6/R5tFK6wL9u96MqYyJ93jLoksPVYXx1Q1TPt5UX5coTZG aQ3g== X-Gm-Message-State: AG10YOQ3mJh0nok2ymqKdErSWUJ6/0jVaryS829fD14r9qQFib539HK/XB8590IgVeB+IwfQMebKz40OUXsAoQ== X-Received: by 10.25.19.220 with SMTP id 89mr13315097lft.33.1456425162354; Thu, 25 Feb 2016 10:32:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.199.234 with HTTP; Thu, 25 Feb 2016 10:32:22 -0800 (PST) In-Reply-To: References: Date: Thu, 25 Feb 2016 13:32:22 -0500 Message-ID: To: Ryan Pallas Cc: Dan Ackroyd , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113f16e071b866052c9c68ae Subject: Re: [PHP-DEV] [RFC] Callable constructors From: ocramius@gmail.com (Marco Pivetta) --001a113f16e071b866052c9c68ae Content-Type: text/plain; charset=UTF-8 On 25 February 2016 at 13:31, Ryan Pallas wrote: > > > On Thu, Feb 25, 2016 at 11:20 AM, Marco Pivetta > wrote: > >> Just adding to the use-cases: I really could've needed this the other day: >> >> >> $records = array_map([MyRecord::class, '__construct'], >> $db->someQuery()->fetchAll()); >> >> I used a named constructor instead, but this results with more internal >> method calls: >> >> $records = array_map([MyRecord::class, 'fromResultSetRow'], >> $db->someQuery()->fetchAll()); >> > > If fetchAll is coming from PDO. then you could have simply done this: > > $records = $db->someQuery()->fetchAll(MyRecord::class); > Not using PDO there. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --001a113f16e071b866052c9c68ae--