Re: Fwd: pdo [was Re: [PHP-DEV] PHP 5.1 roadmap]
| From: | Jeff Moore | Date: | Mon, 25 Oct 2004 18:09:20 +0000 |
| Subject: | Re: Fwd: pdo [was Re: [PHP-DEV] PHP 5.1 roadmap] | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13510@lists.php.net to get a copy of this message | ||
On Oct 25, 2004, at 8:48 AM, Lukas Smith wrote:
D Kingma wrote:I really like that idea. You don't really need the ability to pass a class name if you have that ability: $obj = $stmt->fetch(PDO_FETCH_OBJ, new MyObject()); I imagine this would be a popular form: $obj = $stmt->fetch(PDO_FETCH_OBJ, $this); Whenever I see a method with a constant parameter like this, especially when it involves additional required parameters disguised as optional parameters, I always imagine the constant folded into the function name anyway (see http://www.sitepoint.com/forums/showpost.php?p=913525&postcount=10 ): $stmt->fetch_PDO_FETCH_OBJ($obj); I would prefer to see fetch left alone (and simple) and instead to have this added to the API: $stmt->fetchInto($obj);I just took a view at some PDO examples on the net and it looks promissing. The one thing that I would to see is that the fetch method accepts a class name as optional second parameter (when using PDO_FETCH_OBJ or PDO_FETCH_LAZY) and then returns a new instance of the given class with the given result row as properties (when defined in the class).Yes, that as on the todo at somepoint. Atleast it was on Marcus's todo list at somepoint. Another cool thing to have would be to also be able to pass an existing class instance instead of a class name.