PHQL and columnMap

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 => 'myemail@email.com',
        );

        $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 => 'myemail@email.com',
    );
    $result = \Phalcon\DI::getDefault()->getModelsManager()->executeQuery($phql,$params);
    var_dump($result->success());//return TRUE   and record updated

What trouble with columnMap() ?

Hi @phalcon, do You have any ideas ?



30.8k

Hey

I see document support ORM not support PHQL , link here http://docs.phalconphp.com/en/latest/reference/models.html#independent-column-mapping

Create a issue feature for it