![]() |
|
|||
|
Hi,
Is it possible to do a fetchAll with a specified classname as resultobject? For a single row, I can do this: [PHP]$users = new Users(); $select = $users -> select(); $select -> from("users", Array('userId', 'username', 'fullname', 'email', 'lastlogin', 'isadmin')); $stmt = $this -> db -> query($select); $user = $stmt -> fetchObject("User"); return $user;[/PHP] But I want to have a list of users, not a single user. So something like this: [PHP] $stmt = $this -> db -> query($select); $user = $stmt -> fetchAll("User");[/PHP] The reason I want to have this is because I want (need) classmapping between my Flex application and PHP. Please help! |
|
|||
|
|
|
|||
|
Quote:
|
|
|||
|
? what do you mean by what kind of object?
|
|
|||
|
If want to specify a class as objecttype, instead of php's standard StdClass.
my class looks something like this: [PHP] class User { var $_explicitType = "User"; public $userId = 0; public $username = ""; public $password = ""; public $fullname = ""; public $email = ""; public $lastlogin = ""; public $isadmin = false; }[/PHP] So when I do a fetchAll, I want an array of User classes. |
|
|||
|
FetchAll should work as PDO:
PHP Tutorials Examples Introduction to PHP PDO Quote:
|
|
|||
|
Or if your using a Zend_Db_Table_Abstract object to do the query you can set the protected propert "$_rowClass" and "$_rowsetClass" which will mean object(s) of that type are returned assuming they extend the Zend_Db_row_Abstract (i think) class.
|
|
|||
|
Quote:
Utilizing the Zend AMF Server Inside a Zend Controller | blog.log2e.com Quote:
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Designed by: Miner Skinz |
Powered by vBulletin® Version 3.8.4 Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.1.0 |
![]() |