DB tables default values

Hello,

we are started to move our website to phalcon. Now I have a little question/problem. We migrated our db tables with the phalcon dev tools to a model. Now we need the define for every value a new RawValue. Is it possible the do that automatically, for example with a paramater that i must set in the config ?

Thx for your help and sry for my bad english :)



1.5k

If your database table already has a default value. you just have to not place any value for the model when saving it.

If you are talking about initializing some specific value yourself before saving in php.

public function beforeSave()
{
    $this->myfield = "my default value in php":
}

you can also specify which fields to skip specifically by using meta-data

http://docs.phalconphp.com/en/latest/reference/models.html#meta-data-strategies