.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once 'classes/model/om/BaseGroupUser.php';
require_once 'classes/model/Content.php';
/**
* Skeleton subclass for representing a row from the 'GROUP_USER' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the input directory.
*
* @package classes.model
*/
class GroupUser extends BaseGroupUser {
/**
* Create the application document registry
* @param array $aData
* @return string
**/
public function create($aData)
{
$oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME);
try {
$oGroupUser = new GroupUser();
$oGroupUser->fromArray($aData, BasePeer::TYPE_FIELDNAME);
if ($oGroupUser->validate()) {
$oConnection->begin();
$iResult = $oGroupUser->save();
$oConnection->commit();
return $iResult;
}
else {
$sMessage = '';
$aValidationFailures = $oGroupUser->getValidationFailures();
foreach($aValidationFailures as $oValidationFailure) {
$sMessage .= $oValidationFailure->getMessage() . '
';
}
throw(new Exception('The registry cannot be created!
'.$sMessage));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
/**
* Remove the application document registry
* @param string $sGrpUid
* @param string $sUserUid
* @return string
**/
public function remove($sGrpUid, $sUserUid)
{
$oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME);
try {
$oGroupUser = GroupUserPeer::retrieveByPK($sGrpUid, $sUserUid);
if (!is_null($oGroupUser))
{
$oConnection->begin();
$iResult = $oGroupUser->delete();
$oConnection->commit();
return $iResult;
}
else {
throw(new Exception('This row doesn\'t exists!'));
}
}
catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
} // GroupUser