예제 #1
0
 /**
  * 
  * @param array $values
  */
 public function addServiceGroup(array $values)
 {
     $serviceIds = is_array($values['ws_service_id']) ? $values['ws_service_id'] : array($values['ws_service_id']);
     unset($values['ws_service_id']);
     $this->_model->getDefaultAdapter()->beginTransaction();
     $rowId = $this->_model->addGroup($values);
     $hasWsServiceModel = new WsServiceGroupHasWsService();
     foreach ($serviceIds as $serviceId) {
         $hasWsServiceModel->createRow(array('ws_service_id' => $serviceId, 'ws_service_group_id' => $rowId))->save();
     }
     try {
         $this->_model->getDefaultAdapter()->commit();
     } catch (Exception $exc) {
         $this->_model->getDefaultAdapter()->rollBack();
         throw new Logic_Exception("Cannot save service group data!", 0, $exc);
     }
 }