/** * Validates all modified columns of given Taula3 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 Taula3 $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(Taula3 $obj, $cols = null) { $columns = array(); if ($cols) { $dbMap = Propel::getDatabaseMap(Taula3Peer::DATABASE_NAME); $tableMap = $dbMap->getTable(Taula3Peer::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 { } $res = BasePeer::doValidate(Taula3Peer::DATABASE_NAME, Taula3Peer::TABLE_NAME, $columns); if ($res !== true) { $request = sfContext::getInstance()->getRequest(); foreach ($res as $failed) { $col = Taula3Peer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME); } } return $res; }