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

How to select dummy column

Tell me how to select this scenario (eq: using model::find())

SELECT *, 0 as status FROM Mymodel

where 'status' is not Mymodel member (column).

thx.



2.6k

You can do that with PHQL:

$phql = "SELECT m.*, 0 as status FROM Mymodel AS m";
$rows = $manager->executeQuery($phql);
foreach ($rows as $row) {
    echo $row->someField . "\n";
    echo $row->status . "\n";  //0
}