【发布时间】:2023-03-17 07:05:01
【问题描述】:
我想在 Phalcon PHP 中实现我自己的数据库方言。我想扩展和覆盖一些已经为 PDO 保留的功能。这就是我想要做的:
class DB extends \Phalcon\Db\Adapter\Pdo\Mysql{
function _construct($connection_variables=array())
{
parent::_construct($connection_variables);
}
function update($table="",$variables="")
{
parent::execute($query);
}
}
所以,当我尝试调用模型时:
$this->db->update('test',array('id'=>'1'));
它给了我一个错误说明:
Fatal error: Declaration of Libraries\DB::update() must be compatible with Phalcon\Db\AdapterInterface::update($table, $fields, $values, $whereCondition = NULL, $dataTypes = NULL) in .....
如何覆盖更新和插入函数? 谢谢
【问题讨论】:
标签: php mysql class pdo phalcon