After a couple of months of break from Phalcon I finally came back to my project. In the meantime I updated to 1.3.1. I am now having an issue with model update. In short the following is happening:
$country = Country::findFirst(array(
"conditions"=>"cntID = ?1",
"bind" => array(1 =>$this->persistent->cntID),
"for_update" => true
)
...
$formFields->bind($this->request->getPost(), $country);
try
{
if ($country->update() == false) {
...
$this->flash->error($message->getMessage());
Here I get "Duplicate key (...)" MySQL error. While debugging I noticed that Phalcon instead going to Country->beforeUpdate() it actually goes to Country->beforeCreate(). And I thought that
$country->update()
tells it explicitly to go to beforeUpdate... And at the end Phalcon is trying to do INSERT SQL statement.... This situation is happening always after initial insert of a record and later on attempt of updating it. I know this i as short description. If necessary I will gladly elaborate.