/** * Validates all modified columns of given AppDocument 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 AppDocument $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(AppDocument $obj, $cols = null) { $columns = array(); if ($cols) { $dbMap = Propel::getDatabaseMap(AppDocumentPeer::DATABASE_NAME); $tableMap = $dbMap->getTable(AppDocumentPeer::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(AppDocumentPeer::APP_DOC_UID)) { $columns[AppDocumentPeer::APP_DOC_UID] = $obj->getAppDocUid(); } if ($obj->isNew() || $obj->isColumnModified(AppDocumentPeer::APP_UID)) { $columns[AppDocumentPeer::APP_UID] = $obj->getAppUid(); } if ($obj->isNew() || $obj->isColumnModified(AppDocumentPeer::DEL_INDEX)) { $columns[AppDocumentPeer::DEL_INDEX] = $obj->getDelIndex(); } if ($obj->isNew() || $obj->isColumnModified(AppDocumentPeer::DOC_UID)) { $columns[AppDocumentPeer::DOC_UID] = $obj->getDocUid(); } if ($obj->isNew() || $obj->isColumnModified(AppDocumentPeer::USR_UID)) { $columns[AppDocumentPeer::USR_UID] = $obj->getUsrUid(); } if ($obj->isNew() || $obj->isColumnModified(AppDocumentPeer::APP_DOC_TYPE)) { $columns[AppDocumentPeer::APP_DOC_TYPE] = $obj->getAppDocType(); } if ($obj->isNew() || $obj->isColumnModified(AppDocumentPeer::APP_DOC_CREATE_DATE)) { $columns[AppDocumentPeer::APP_DOC_CREATE_DATE] = $obj->getAppDocCreateDate(); } if ($obj->isNew() || $obj->isColumnModified(AppDocumentPeer::APP_DOC_STATUS)) { $columns[AppDocumentPeer::APP_DOC_STATUS] = $obj->getAppDocStatus(); } } return BasePeer::doValidate(AppDocumentPeer::DATABASE_NAME, AppDocumentPeer::TABLE_NAME, $columns); }