Merged in marcoAntonioNina/processmaker/BUG-14636 (pull request #772)

BUG-14636 New Functionality - To allow set index in tables SOLVED
This commit is contained in:
Julio Cesar Laura Avendaño
2014-09-11 11:59:40 -04:00
10 changed files with 505 additions and 230 deletions

View File

@@ -97,6 +97,7 @@ class AdditionalTables extends BaseAdditionalTables
$oCriteria->addSelectColumn(FieldsPeer::FLD_NULL);
$oCriteria->addSelectColumn(FieldsPeer::FLD_AUTO_INCREMENT);
$oCriteria->addSelectColumn(FieldsPeer::FLD_KEY);
$oCriteria->addSelectColumn(FieldsPeer::FLD_TABLE_INDEX);
$oCriteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY);
$oCriteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY_TABLE);
$oCriteria->addSelectColumn(FieldsPeer::FLD_DYN_NAME);

View File

@@ -85,7 +85,9 @@ class FieldsMapBuilder
$tMap->addColumn('FLD_KEY', 'FldKey', 'int', CreoleTypes::TINYINT, true, null);
$tMap->addColumn('FLD_FOREIGN_KEY', 'FldForeignKey', 'int', CreoleTypes::TINYINT, true, null);
$tMap->addColumn('FLD_TABLE_INDEX', 'FldTableIndex', 'int', CreoleTypes::TINYINT, true, null);
$tMap->addColumn('FLD_FOREIGN_KEY', 'FldForeignKey', 'int', CreoleTypes::TINYINT, false, null);
$tMap->addColumn('FLD_FOREIGN_KEY_TABLE', 'FldForeignKeyTable', 'string', CreoleTypes::VARCHAR, true, 32);

View File

@@ -87,6 +87,12 @@ abstract class BaseFields extends BaseObject implements Persistent
*/
protected $fld_key = 0;
/**
* The value for the fld_table_index field.
* @var int
*/
protected $fld_table_index = 0;
/**
* The value for the fld_foreign_key field.
* @var int
@@ -241,6 +247,17 @@ abstract class BaseFields extends BaseObject implements Persistent
return $this->fld_key;
}
/**
* Get the [fld_table_index] column value.
*
* @return int
*/
public function getFldTableIndex()
{
return $this->fld_table_index;
}
/**
* Get the [fld_foreign_key] column value.
*
@@ -516,6 +533,28 @@ abstract class BaseFields extends BaseObject implements Persistent
} // setFldKey()
/**
* Set the value of [fld_table_index] column.
*
* @param int $v new value
* @return void
*/
public function setFldTableIndex($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->fld_table_index !== $v || $v === 0) {
$this->fld_table_index = $v;
$this->modifiedColumns[] = FieldsPeer::FLD_TABLE_INDEX;
}
} // setFldTableIndex()
/**
* Set the value of [fld_foreign_key] column.
*
@@ -663,22 +702,24 @@ abstract class BaseFields extends BaseObject implements Persistent
$this->fld_key = $rs->getInt($startcol + 9);
$this->fld_foreign_key = $rs->getInt($startcol + 10);
$this->fld_table_index = $rs->getInt($startcol + 10);
$this->fld_foreign_key_table = $rs->getString($startcol + 11);
$this->fld_foreign_key = $rs->getInt($startcol + 11);
$this->fld_dyn_name = $rs->getString($startcol + 12);
$this->fld_foreign_key_table = $rs->getString($startcol + 12);
$this->fld_dyn_uid = $rs->getString($startcol + 13);
$this->fld_dyn_name = $rs->getString($startcol + 13);
$this->fld_filter = $rs->getInt($startcol + 14);
$this->fld_dyn_uid = $rs->getString($startcol + 14);
$this->fld_filter = $rs->getInt($startcol + 15);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 15; // 15 = FieldsPeer::NUM_COLUMNS - FieldsPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 16; // 16 = FieldsPeer::NUM_COLUMNS - FieldsPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating Fields object", $e);
@@ -913,18 +954,21 @@ abstract class BaseFields extends BaseObject implements Persistent
return $this->getFldKey();
break;
case 10:
return $this->getFldForeignKey();
return $this->getFldTableIndex();
break;
case 11:
return $this->getFldForeignKeyTable();
return $this->getFldForeignKey();
break;
case 12:
return $this->getFldDynName();
return $this->getFldForeignKeyTable();
break;
case 13:
return $this->getFldDynUid();
return $this->getFldDynName();
break;
case 14:
return $this->getFldDynUid();
break;
case 15:
return $this->getFldFilter();
break;
default:
@@ -957,11 +1001,12 @@ abstract class BaseFields extends BaseObject implements Persistent
$keys[7] => $this->getFldNull(),
$keys[8] => $this->getFldAutoIncrement(),
$keys[9] => $this->getFldKey(),
$keys[10] => $this->getFldForeignKey(),
$keys[11] => $this->getFldForeignKeyTable(),
$keys[12] => $this->getFldDynName(),
$keys[13] => $this->getFldDynUid(),
$keys[14] => $this->getFldFilter(),
$keys[10] => $this->getFldTableIndex(),
$keys[11] => $this->getFldForeignKey(),
$keys[12] => $this->getFldForeignKeyTable(),
$keys[13] => $this->getFldDynName(),
$keys[14] => $this->getFldDynUid(),
$keys[15] => $this->getFldFilter(),
);
return $result;
}
@@ -1024,18 +1069,21 @@ abstract class BaseFields extends BaseObject implements Persistent
$this->setFldKey($value);
break;
case 10:
$this->setFldForeignKey($value);
$this->setFldTableIndex($value);
break;
case 11:
$this->setFldForeignKeyTable($value);
$this->setFldForeignKey($value);
break;
case 12:
$this->setFldDynName($value);
$this->setFldForeignKeyTable($value);
break;
case 13:
$this->setFldDynUid($value);
$this->setFldDynName($value);
break;
case 14:
$this->setFldDynUid($value);
break;
case 15:
$this->setFldFilter($value);
break;
} // switch()
@@ -1102,23 +1150,27 @@ abstract class BaseFields extends BaseObject implements Persistent
}
if (array_key_exists($keys[10], $arr)) {
$this->setFldForeignKey($arr[$keys[10]]);
$this->setFldTableIndex($arr[$keys[10]]);
}
if (array_key_exists($keys[11], $arr)) {
$this->setFldForeignKeyTable($arr[$keys[11]]);
$this->setFldForeignKey($arr[$keys[11]]);
}
if (array_key_exists($keys[12], $arr)) {
$this->setFldDynName($arr[$keys[12]]);
$this->setFldForeignKeyTable($arr[$keys[12]]);
}
if (array_key_exists($keys[13], $arr)) {
$this->setFldDynUid($arr[$keys[13]]);
$this->setFldDynName($arr[$keys[13]]);
}
if (array_key_exists($keys[14], $arr)) {
$this->setFldFilter($arr[$keys[14]]);
$this->setFldDynUid($arr[$keys[14]]);
}
if (array_key_exists($keys[15], $arr)) {
$this->setFldFilter($arr[$keys[15]]);
}
}
@@ -1172,6 +1224,10 @@ abstract class BaseFields extends BaseObject implements Persistent
$criteria->add(FieldsPeer::FLD_KEY, $this->fld_key);
}
if ($this->isColumnModified(FieldsPeer::FLD_TABLE_INDEX)) {
$criteria->add(FieldsPeer::FLD_TABLE_INDEX, $this->fld_table_index);
}
if ($this->isColumnModified(FieldsPeer::FLD_FOREIGN_KEY)) {
$criteria->add(FieldsPeer::FLD_FOREIGN_KEY, $this->fld_foreign_key);
}
@@ -1264,6 +1320,8 @@ abstract class BaseFields extends BaseObject implements Persistent
$copyObj->setFldKey($this->fld_key);
$copyObj->setFldTableIndex($this->fld_table_index);
$copyObj->setFldForeignKey($this->fld_foreign_key);
$copyObj->setFldForeignKeyTable($this->fld_foreign_key_table);

View File

@@ -25,7 +25,7 @@ abstract class BaseFieldsPeer
const CLASS_DEFAULT = 'classes.model.Fields';
/** The total number of columns. */
const NUM_COLUMNS = 15;
const NUM_COLUMNS = 16;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -61,6 +61,9 @@ abstract class BaseFieldsPeer
/** the column name for the FLD_KEY field */
const FLD_KEY = 'FIELDS.FLD_KEY';
/** the column name for the FLD_TABLE_INDEX field */
const FLD_TABLE_INDEX = 'FIELDS.FLD_TABLE_INDEX';
/** the column name for the FLD_FOREIGN_KEY field */
const FLD_FOREIGN_KEY = 'FIELDS.FLD_FOREIGN_KEY';
@@ -87,10 +90,10 @@ abstract class BaseFieldsPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('FldUid', 'AddTabUid', 'FldIndex', 'FldName', 'FldDescription', 'FldType', 'FldSize', 'FldNull', 'FldAutoIncrement', 'FldKey', 'FldForeignKey', 'FldForeignKeyTable', 'FldDynName', 'FldDynUid', 'FldFilter', ),
BasePeer::TYPE_COLNAME => array (FieldsPeer::FLD_UID, FieldsPeer::ADD_TAB_UID, FieldsPeer::FLD_INDEX, FieldsPeer::FLD_NAME, FieldsPeer::FLD_DESCRIPTION, FieldsPeer::FLD_TYPE, FieldsPeer::FLD_SIZE, FieldsPeer::FLD_NULL, FieldsPeer::FLD_AUTO_INCREMENT, FieldsPeer::FLD_KEY, FieldsPeer::FLD_FOREIGN_KEY, FieldsPeer::FLD_FOREIGN_KEY_TABLE, FieldsPeer::FLD_DYN_NAME, FieldsPeer::FLD_DYN_UID, FieldsPeer::FLD_FILTER, ),
BasePeer::TYPE_FIELDNAME => array ('FLD_UID', 'ADD_TAB_UID', 'FLD_INDEX', 'FLD_NAME', 'FLD_DESCRIPTION', 'FLD_TYPE', 'FLD_SIZE', 'FLD_NULL', 'FLD_AUTO_INCREMENT', 'FLD_KEY', 'FLD_FOREIGN_KEY', 'FLD_FOREIGN_KEY_TABLE', 'FLD_DYN_NAME', 'FLD_DYN_UID', 'FLD_FILTER', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
BasePeer::TYPE_PHPNAME => array ('FldUid', 'AddTabUid', 'FldIndex', 'FldName', 'FldDescription', 'FldType', 'FldSize', 'FldNull', 'FldAutoIncrement', 'FldKey', 'FldTableIndex', 'FldForeignKey', 'FldForeignKeyTable', 'FldDynName', 'FldDynUid', 'FldFilter', ),
BasePeer::TYPE_COLNAME => array (FieldsPeer::FLD_UID, FieldsPeer::ADD_TAB_UID, FieldsPeer::FLD_INDEX, FieldsPeer::FLD_NAME, FieldsPeer::FLD_DESCRIPTION, FieldsPeer::FLD_TYPE, FieldsPeer::FLD_SIZE, FieldsPeer::FLD_NULL, FieldsPeer::FLD_AUTO_INCREMENT, FieldsPeer::FLD_KEY, FieldsPeer::FLD_TABLE_INDEX, FieldsPeer::FLD_FOREIGN_KEY, FieldsPeer::FLD_FOREIGN_KEY_TABLE, FieldsPeer::FLD_DYN_NAME, FieldsPeer::FLD_DYN_UID, FieldsPeer::FLD_FILTER, ),
BasePeer::TYPE_FIELDNAME => array ('FLD_UID', 'ADD_TAB_UID', 'FLD_INDEX', 'FLD_NAME', 'FLD_DESCRIPTION', 'FLD_TYPE', 'FLD_SIZE', 'FLD_NULL', 'FLD_AUTO_INCREMENT', 'FLD_KEY', 'FLD_TABLE_INDEX', 'FLD_FOREIGN_KEY', 'FLD_FOREIGN_KEY_TABLE', 'FLD_DYN_NAME', 'FLD_DYN_UID', 'FLD_FILTER', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -100,10 +103,10 @@ abstract class BaseFieldsPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('FldUid' => 0, 'AddTabUid' => 1, 'FldIndex' => 2, 'FldName' => 3, 'FldDescription' => 4, 'FldType' => 5, 'FldSize' => 6, 'FldNull' => 7, 'FldAutoIncrement' => 8, 'FldKey' => 9, 'FldForeignKey' => 10, 'FldForeignKeyTable' => 11, 'FldDynName' => 12, 'FldDynUid' => 13, 'FldFilter' => 14, ),
BasePeer::TYPE_COLNAME => array (FieldsPeer::FLD_UID => 0, FieldsPeer::ADD_TAB_UID => 1, FieldsPeer::FLD_INDEX => 2, FieldsPeer::FLD_NAME => 3, FieldsPeer::FLD_DESCRIPTION => 4, FieldsPeer::FLD_TYPE => 5, FieldsPeer::FLD_SIZE => 6, FieldsPeer::FLD_NULL => 7, FieldsPeer::FLD_AUTO_INCREMENT => 8, FieldsPeer::FLD_KEY => 9, FieldsPeer::FLD_FOREIGN_KEY => 10, FieldsPeer::FLD_FOREIGN_KEY_TABLE => 11, FieldsPeer::FLD_DYN_NAME => 12, FieldsPeer::FLD_DYN_UID => 13, FieldsPeer::FLD_FILTER => 14, ),
BasePeer::TYPE_FIELDNAME => array ('FLD_UID' => 0, 'ADD_TAB_UID' => 1, 'FLD_INDEX' => 2, 'FLD_NAME' => 3, 'FLD_DESCRIPTION' => 4, 'FLD_TYPE' => 5, 'FLD_SIZE' => 6, 'FLD_NULL' => 7, 'FLD_AUTO_INCREMENT' => 8, 'FLD_KEY' => 9, 'FLD_FOREIGN_KEY' => 10, 'FLD_FOREIGN_KEY_TABLE' => 11, 'FLD_DYN_NAME' => 12, 'FLD_DYN_UID' => 13, 'FLD_FILTER' => 14, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
BasePeer::TYPE_PHPNAME => array ('FldUid' => 0, 'AddTabUid' => 1, 'FldIndex' => 2, 'FldName' => 3, 'FldDescription' => 4, 'FldType' => 5, 'FldSize' => 6, 'FldNull' => 7, 'FldAutoIncrement' => 8, 'FldKey' => 9, 'FldTableIndex' => 10, 'FldForeignKey' => 11, 'FldForeignKeyTable' => 12, 'FldDynName' => 13, 'FldDynUid' => 14, 'FldFilter' => 15, ),
BasePeer::TYPE_COLNAME => array (FieldsPeer::FLD_UID => 0, FieldsPeer::ADD_TAB_UID => 1, FieldsPeer::FLD_INDEX => 2, FieldsPeer::FLD_NAME => 3, FieldsPeer::FLD_DESCRIPTION => 4, FieldsPeer::FLD_TYPE => 5, FieldsPeer::FLD_SIZE => 6, FieldsPeer::FLD_NULL => 7, FieldsPeer::FLD_AUTO_INCREMENT => 8, FieldsPeer::FLD_KEY => 9, FieldsPeer::FLD_TABLE_INDEX => 10, FieldsPeer::FLD_FOREIGN_KEY => 11, FieldsPeer::FLD_FOREIGN_KEY_TABLE => 12, FieldsPeer::FLD_DYN_NAME => 13, FieldsPeer::FLD_DYN_UID => 14, FieldsPeer::FLD_FILTER => 15, ),
BasePeer::TYPE_FIELDNAME => array ('FLD_UID' => 0, 'ADD_TAB_UID' => 1, 'FLD_INDEX' => 2, 'FLD_NAME' => 3, 'FLD_DESCRIPTION' => 4, 'FLD_TYPE' => 5, 'FLD_SIZE' => 6, 'FLD_NULL' => 7, 'FLD_AUTO_INCREMENT' => 8, 'FLD_KEY' => 9, 'FLD_TABLE_INDEX' => 10, 'FLD_FOREIGN_KEY' => 11, 'FLD_FOREIGN_KEY_TABLE' => 12, 'FLD_DYN_NAME' => 13, 'FLD_DYN_UID' => 14, 'FLD_FILTER' => 15, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -224,6 +227,8 @@ abstract class BaseFieldsPeer
$criteria->addSelectColumn(FieldsPeer::FLD_KEY);
$criteria->addSelectColumn(FieldsPeer::FLD_TABLE_INDEX);
$criteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY);
$criteria->addSelectColumn(FieldsPeer::FLD_FOREIGN_KEY_TABLE);

View File

@@ -348,7 +348,7 @@ abstract class BaseHolidayPeer
$criteria = $values->buildCriteria(); // build Criteria from Holiday object
}
$criteria->remove(HolidayPeer::HLD_UID); // remove pkey col since this table uses auto-increment
//$criteria->remove(HolidayPeer::HLD_UID); // remove pkey col since this table uses auto-increment
// Set the correct dbName