I am using Doctrine 1.2, how could I get the query object into json / array format?
$user = Doctrine_Query::create()
->select('u.id, u.username, u.firstname, u.lastname')
->from('User u')
->orderby('u.id')
->execute();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A solution might be to use the
toArray()method on the$userobject, to have a simple array containing only the data youre interested in, and, then, usejson_encodeto convert that PHP array to a JSON string.Something like this, I suppose :
(Not tested, but it should not be too far from working…)