public function saveSubunit(Subunit $subunit) { try { if ($subunit->getId() == '') { $subunit->setId(0); } else { $tempObj = Doctrine::getTable('Subunit')->find($subunit->getId()); $tempObj->setName($subunit->getName()); $tempObj->setDescription($subunit->getDescription()); $tempObj->setUnitId($subunit->getUnitId()); $subunit = $tempObj; } $subunit->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }