$connection = ConnectionManager::get('default');
$query = $connection->execute('SELECT * FROM dc_dogs')->fetchAll('obj');
Correct results are given.
So in querybuilder the developers manipulated the way results are returned instead of letting mysql just return natural as is results. Makes no sense.
If null is stored then null should be returned, but if 0 (zero) is stored then 0 should be returned, ditto for 1 (one). What gives anyone the right to hack up mysql returned results? What is wrong with letting itself return what is actually stored, then the view code can be formatted as needed.
By the way that is how other very popular and good frameworks do things.
Works correctly and displays the 0 (zero). Doesn’t it make you wonder if the cake developers were so concerned about boolean returns, then why does native database return the actual value stored.
Sorry as I can be, this having querybuilder different from database just doesn’t make sense.
I know cakephp is open source and free so I can’t really complain. But I even created an issue and it was just dismissed basically.
But the bottom line is if a 0 is stored you should retrieve a 0. And if it’s a checkbox, then the developer should know how to handle a checkbox as displayed above.
EDIT: I just looked at formhelper it shows
Which a checkbox I do display on user form, but the admin page I just display a 0 or 1 in the listview (table view). No need to have a checkbox displayed there. I suppose I could, may even play around with that.