Hi all. I have trouble with PHQL.
$di->set('modelsManager', function() {
return new Phalcon\Mvc\Model\Manager();
});
namespace Models;
class Person extends \Phalcon\Mvc\Model{
//indicate public variables
....
public $inviteId;
....
//indicate columnMap
public function columnMap()
{
return [
//another key => value of table
'invite_id' => 'inviteId',
];
}
}
And when I try do this
$phql = "Update \Models\Person SET inviteId = ?0 where email = ?1";
$params = array(
0 => 'BxvQ7aIbmRV',
1 => '[email protected]',
);
$result = \Phalcon\DI::getDefault()->getModelsManager()->executeQuery($phql,$params);
var_dump($result->success());//return TRUE but records not updated
After this - records not updated,
but when i changed inviteId to invite_id in columnMap() - records updated.
public function columnMap()
{
return [
//another key => value of table
'invite_id' => 'invite_id',
];
}
$phql = "Update \Models\Person SET invite_id = ?0 where email = ?1";
$params = array(
0 => 'BxvQ7aIbmRV',
1 => '[email protected]',
);
$result = \Phalcon\DI::getDefault()->getModelsManager()->executeQuery($phql,$params);
var_dump($result->success());//return TRUE and record updated
What trouble with columnMap() ?