示例#1
0
 public function create($aData)
 {
     $oConnection = Propel::getConnection(AppEventPeer::DATABASE_NAME);
     try {
         $oAppEvent = new AppEvent();
         $oAppEvent->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oAppEvent->validate()) {
             $oConnection->begin();
             $iResult = $oAppEvent->save();
             $oConnection->commit();
             return true;
         } else {
             $sMessage = '';
             $aValidationFailures = $oAppEvent->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }