/** * Validates all modified columns of given ReportTable 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 ReportTable $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(ReportTable $obj, $cols = null) { $columns = array(); if ($cols) { $dbMap = Propel::getDatabaseMap(ReportTablePeer::DATABASE_NAME); $tableMap = $dbMap->getTable(ReportTablePeer::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(ReportTablePeer::REP_TAB_UID)) { $columns[ReportTablePeer::REP_TAB_UID] = $obj->getRepTabUid(); } if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::PRO_UID)) { $columns[ReportTablePeer::PRO_UID] = $obj->getProUid(); } if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_NAME)) { $columns[ReportTablePeer::REP_TAB_NAME] = $obj->getRepTabName(); } if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_TYPE)) { $columns[ReportTablePeer::REP_TAB_TYPE] = $obj->getRepTabType(); } if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_CONNECTION)) { $columns[ReportTablePeer::REP_TAB_CONNECTION] = $obj->getRepTabConnection(); } if ($obj->isNew() || $obj->isColumnModified(ReportTablePeer::REP_TAB_STATUS)) { $columns[ReportTablePeer::REP_TAB_STATUS] = $obj->getRepTabStatus(); } } return BasePeer::doValidate(ReportTablePeer::DATABASE_NAME, ReportTablePeer::TABLE_NAME, $columns); }