cphalcon: Object of class Phalcon\Db\RawValue could not be converted to float

Expected and Actual Behavior

Describe what you are trying to achieve and what goes wrong.

Provide output if related. Provide coredump if any. Use https://github.com/phalcon/cphalcon/wiki/Generating-a-backtrace as reference

<?php
namespace Tasks;

use PhalconExt\Cli\Task;

class LogsTasks extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var integer
     * @Primary
     * @Identity
     * @Column(type="integer", length=10, nullable=false)
     */
    public $id;

    /**
     *
     * @var double
     * @Column(type="double", length=9, nullable=true)
     */
    public $exec_time;

    /**
     *
     * @var integer
     * @Column(type="integer", length=10, nullable=false)
     */
    public $pid;

}

class IssueTask extends Task
{

    /**
     * @help("Воспроизведение ошибки")
     * @paramsFormat("<y>cli.php {task} {action}</y>")
     * @shortcut("12766")
     * @param type $param
     */
    public function issue12766Action($parameters = null)
    {
        $model = new LogsTasks;
        $model->pid = 1212;
        $model->save();

        $model->exec_time = 0.1212;

        $saved = $model->update();
    }
}

DB Scheme

CREATE TABLE `logs_tasks` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,  
  `exec_time` decimal(9,3) DEFAULT NULL,
  `pid` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `pid` (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

When update model get error

Notice: Object of class Phalcon\Db\RawValue could not be converted to float in Z:\OpenServer\server\trunk\app\cli\tasks\IssueTask.php on line 56

Details

  • Phalcon version: 3.1.1
  • PHP Version: PHP 7.0.15 (cli) (built: Jan 17 2017 13:44:27) ( NTS )
  • Operating System: Win 7
  • Database: MariaDB-5.5-x64

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Created PR.

Yea, now i see, let me fix it.