/** * Validates all modified columns of given AppDelegation object. * If parameter $columns is either a single column name or an array of column names * than only those columns are validated. * * NOTICE: This does not apply to primary or foreign keys for now. * * @param AppDelegation $obj The object to validate. * @param mixed $cols Column name or array of column names. * * @return mixed TRUE if all columns are valid or the error message of the first invalid column. */ public static function doValidate(AppDelegation $obj, $cols = null) { $columns = array(); if ($cols) { $dbMap = Propel::getDatabaseMap(AppDelegationPeer::DATABASE_NAME); $tableMap = $dbMap->getTable(AppDelegationPeer::TABLE_NAME); if (!is_array($cols)) { $cols = array($cols); } foreach ($cols as $colName) { if ($tableMap->containsColumn($colName)) { $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); $columns[$colName] = $obj->{$get}(); } } } else { if ($obj->isNew() || $obj->isColumnModified(AppDelegationPeer::DEL_TYPE)) { $columns[AppDelegationPeer::DEL_TYPE] = $obj->getDelType(); } if ($obj->isNew() || $obj->isColumnModified(AppDelegationPeer::DEL_PRIORITY)) { $columns[AppDelegationPeer::DEL_PRIORITY] = $obj->getDelPriority(); } if ($obj->isNew() || $obj->isColumnModified(AppDelegationPeer::DEL_THREAD_STATUS)) { $columns[AppDelegationPeer::DEL_THREAD_STATUS] = $obj->getDelThreadStatus(); } } return BasePeer::doValidate(AppDelegationPeer::DATABASE_NAME, AppDelegationPeer::TABLE_NAME, $columns); }