コード例 #1
0
 public function create($aData)
 {
     $oConnection = Propel::getConnection(UsersPropertiesPeer::DATABASE_NAME);
     try {
         $oUserProperty = new UsersProperties();
         $oUserProperty->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oUserProperty->validate()) {
             $oConnection->begin();
             $iResult = $oUserProperty->save();
             $oConnection->commit();
             return true;
         } else {
             $sMessage = '';
             $aValidationFailures = $oUserProperty->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;
     }
 }