Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Phalcon:MySQL触发器不适用于Phalcon框架_Mysql_Phalcon - Fatal编程技术网

Phalcon:MySQL触发器不适用于Phalcon框架

Phalcon:MySQL触发器不适用于Phalcon框架,mysql,phalcon,Mysql,Phalcon,我有一个location表,其中列有lat、lng和该点的geohash,以及相关的locationPhalcon模型。在MySQL中,我有一个before insert类型的触发器函数,在添加位置行时自动生成geohash(作为VARCHAR),因此如果我放入SQL: INSERT INTO location (lat, lng) VALUES (100, 100); 将(100100)的geohash正确插入geohash列 但是如果我像这样使用phalcon $location = ne

我有一个
location
表,其中列有
lat
lng
和该点的
geohash
,以及相关的
location
Phalcon模型。在MySQL中,我有一个
before insert
类型的触发器函数,在添加位置行时自动生成geohash(作为VARCHAR),因此如果我放入SQL:

INSERT INTO location (lat, lng) VALUES (100, 100);
将(100100)的geohash正确插入geohash列

但是如果我像这样使用phalcon

$location = new Location();
$location->lat = 100;
$location->lng = 100;
$location->save();

。。。触发器被忽略(或者它写入的值被覆盖)为
NULL
。我错过什么了吗?有没有其他人在MySQL触发器和Phalcon之间有过类似的问题。我想知道为什么会这样。非常感谢任何想法。

回答我自己的问题

添加了以下行:

$this->skipAttributes(array("geohash"));
位置
对象的
初始化()
方法。看起来很好用