/** * @param null $file */ public function write() { $dbvals = $this->getDbValues(); $isnew = array(); foreach ($dbvals as $var) { /** @var PaypalConfig $var */ $isnew[$var->getName()] = true; } $this->pushValues(); $vars = $this->getThisVars(); foreach ($vars as $key => $value) { $tmp = new PaypalConfig(); $tmp->setNew(!isset($isnew[$key])); $tmp->setName($key); $tmp->setValue($value); $tmp->save(); } }