/** * Validates all modified columns of given TaskUser 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 TaskUser $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(TaskUser $obj, $cols = null) { $columns = array(); if ($cols) { $dbMap = Propel::getDatabaseMap(TaskUserPeer::DATABASE_NAME); $tableMap = $dbMap->getTable(TaskUserPeer::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(TaskUserPeer::TAS_UID)) { $columns[TaskUserPeer::TAS_UID] = $obj->getTasUid(); } if ($obj->isNew() || $obj->isColumnModified(TaskUserPeer::USR_UID)) { $columns[TaskUserPeer::USR_UID] = $obj->getUsrUid(); } if ($obj->isNew() || $obj->isColumnModified(TaskUserPeer::TU_TYPE)) { $columns[TaskUserPeer::TU_TYPE] = $obj->getTuType(); } if ($obj->isNew() || $obj->isColumnModified(TaskUserPeer::TU_RELATION)) { $columns[TaskUserPeer::TU_RELATION] = $obj->getTuRelation(); } } return BasePeer::doValidate(TaskUserPeer::DATABASE_NAME, TaskUserPeer::TABLE_NAME, $columns); }