public function preSave(PHP5ObjectBuilder $builder)
 {
     $script = "if (\$this->isVersioningNecessary()) {\n    \$this->set{$this->getColumnPhpName()}(\$this->isNew() ? 1 : \$this->getLastVersionNumber(\$con) + 1);";
     if ($this->behavior->getParameter('log_created_at') == 'true') {
         $col = $this->behavior->getTable()->getColumn($this->getParameter('version_created_at_column'));
         $script .= "\n    if (!\$this->isColumnModified({$this->builder->getColumnConstant($col)})) {\n        \$this->{$this->getColumnSetter('version_created_at_column')}(time());\n    }";
     }
     if ($this->behavior->getParameter('log_comment') == 'true') {
         $col = $this->behavior->getTable()->getColumn($this->getParameter('version_comment_column'));
         $script .= "\n    if (!\$this->isColumnModified({$this->builder->getColumnConstant($col)})) {\n        \$this->{$this->getColumnSetter('version_comment_column')}(null);\n    }";
     }
     $script .= "\n    \$createVersion = true; // for postSave hook\n}";
     return $script;
 }
 public function __construct(VersionableBehavior $behavior)
 {
     $this->behavior = $behavior;
     $this->table = $behavior->getTable();
 }