public function save() { $values = $this->getValues(); Doctrine::getTable('Params')->createQuery('p')->delete()->execute(); foreach ($values as $space => $vs) { foreach ($vs as $name => $v) { $p = new Params(); $p->space = $space; $p->name = $name; if (is_array($v)) { $v = serialize($v); } $p->value = $v; $p->save(); } } }