Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Issue with MySQL trigger vs. Phalcon

Hi, I have a location table with columns lat, lng and the geohash of the point, and associated Location Phalcon model. In MySQL I have a before insert type trigger function that automatically generates the geohash (as a VARCHAR) when a location row is added, so if I put in the SQL:

INSERT INTO location (lat, lng) VALUES (100, 100); 

the geohash for (100,100) is duly inserted in into the geohash column.

However if I user phalcon like this ...

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

... the trigger is ignored (or perhaps the value it writes is overwritten) to NULL. Am I missing something? Has anyone else had simillar isses with MySQL triggers vs. Phalcon. Would like to know why this is happening. Any ideas much appreciated.


Answering my own question...

Added the following line:


to Location object's initialise() method. Seems to be working okay.