/** * Store model in the db * if $model->id is null, add a new row * @param Application_Model_Device $model */ public function save(Application_Model_Device $model) { $data = array('label' => $model->getLabel(), 'idProfile' => $model->getIdProfile(), 'pattern' => $model->getPattern(), 'exact' => $model->isExact() ? 1 : 0, 'guiClass' => $model->getGuiClass(), 'priority' => $model->getPriority(), 'extra' => $model->getExtra()); if (null === ($id = $model->getId())) { unset($data['id']); $id = $this->getDbTable()->insert($data); $model->setId($id); } else { $this->getDbTable()->update($data, array('id = ?' => $id)); } }