There is big problem with models in Phalcon 1.1. I have similar code like this:
class User extends \Phalcon\Mvc\Model
{
public $id;
public $email;
function myCustomUserCreator(){
$newUser = new User();
$newUser->email= 'test';
if($newUser->save()==false){
return false;
} else {
return $newUser->id;
}
}
}
print User::myCustomUserCreator();
This code always execute UPDATE and on execution returns new values from mysql auto increment (1,2,3,4 etc.) This is very strange, because I wrote "new User()", what means that I have to INSERT new record in table with save(). Can somebody explain why it works so or it is some phalcon bug? In other frameworks (Yii, Zend) this works without problems.