We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

SELECT a column in ORM

Assume there is a table called users, and it has id,name,email fileds . this code: $info = Users::find(array( "name = 'vandad' ") ); I am not sure about above code what the exact form of SQL command is. I just want to SELECT email field but it seems the above code SELECT all fields firstly.

How can I SELECT specific a field through ORM architecture?

Thanks.



3.0k
Accepted
answer

I've found out the answer : I should have use $info = Users::find(array( "columns" =>"email", "name = 'vandad' " )); When using this option an incomplete object is returned, here is email.

I was wondering how to do this, thank you man! :D