I have two very basic questions regarding lists of VOs in Cairngorm.
I'm using AMFPHP to retreive data from a MySQL database. A usual
method looks like this (PHP):
---------------------------------------------
function getUsers() {
$query = "SELECT uid,username,password,email FROM users";
$result = mysql_query($query);
while ($row = mysql_fetch_object($result)) {
$arrayOfUsers[] = $row;
}
return($arrayOfUsers);
}
---------------------------------------------
Everything works fine, the data is stored as an array in the
ModelLocator (model.users), and I use DataBinding to populate a
DataGrid. But I learned from Steven Webster's excellent 6-part article
series that it is good practice to store information as VOs or as a
list of VOs (in his example it's the list of the product's in a
customer's shopping cart).
Question 1: How do I "convert" my array into a list of VOs? Or is my
array already a list of VOs?
Question 2: Let's say I want to use the same array (model.users) as a
dataProvider for a ComboBox component somewhere else in the
application. I can set up DataBinding for the ComboBox like I did with
the DataGrid. But the ComboBox needs a "data" and a "label" field. I
can set the label field to "username" with the "labelField" property,
but how do I set the "data" field? I want the "uid" field from my SQL
query to be the data field in the ComboBox. - Or am I supposed to use
an SQL statement like this "SELECT uid,uid AS data,username, password,
email FROM users"?
Thanks in advance.
Stefan Schmalhaus
------------------------ Yahoo! Groups Sponsor --------------------~-->
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/3EuRwD/bOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/