Esempio n. 1
0
 public function save($item_params = '*')
 {
     $db = Zend_Registry::get('db');
     $mapper = new SxModule_Pageform_Subscription_Meta_Mapper();
     if (is_array($this->getValue())) {
         $this->setValue(implode(",", $this->getValue()));
     }
     $item = $mapper->toArray($this);
     if (is_array($item_params)) {
         $item = $mapper->fromInput($item, $item_params);
     }
     if ($this->getId()) {
         $db->update($this->_tablename(), $item, $this->_primary_key() . ' = ' . (int) $this->getId());
     } else {
         $db->insert($this->_tablename(), $item);
         $this->setId($db->lastInsertId());
     }
     return $this;
 }