Пример #1
0
 /**
  * Validates all modified columns of given Process 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      Process $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(Process $obj, $cols = null)
 {
     $columns = array();
     if ($cols) {
         $dbMap = Propel::getDatabaseMap(ProcessPeer::DATABASE_NAME);
         $tableMap = $dbMap->getTable(ProcessPeer::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(ProcessPeer::PRO_TIMEUNIT)) {
             $columns[ProcessPeer::PRO_TIMEUNIT] = $obj->getProTimeunit();
         }
         if ($obj->isNew() || $obj->isColumnModified(ProcessPeer::PRO_STATUS)) {
             $columns[ProcessPeer::PRO_STATUS] = $obj->getProStatus();
         }
         if ($obj->isNew() || $obj->isColumnModified(ProcessPeer::PRO_TYPE)) {
             $columns[ProcessPeer::PRO_TYPE] = $obj->getProType();
         }
         if ($obj->isNew() || $obj->isColumnModified(ProcessPeer::PRO_ASSIGNMENT)) {
             $columns[ProcessPeer::PRO_ASSIGNMENT] = $obj->getProAssignment();
         }
     }
     return BasePeer::doValidate(ProcessPeer::DATABASE_NAME, ProcessPeer::TABLE_NAME, $columns);
 }
Пример #2
0
function delProcess($id)
{
    $tobeDeleted = new Process($id);
    if ($tobeDeleted->isNew()) {
        return true;
    }
    // item never existed in the first place
    if ($tobeDeleted->del()) {
        return true;
    } else {
        return $tobeDeleted;
    }
}