Added new column in gateway 'GAT_NEXT_TYPE'

This commit is contained in:
girish
2011-02-17 11:31:56 +00:00
parent 8e20135fc5
commit 2aabd3322a
5 changed files with 81 additions and 10 deletions

View File

@@ -78,6 +78,8 @@ class GatewayMapBuilder {
$tMap->addColumn('GAT_TYPE', 'GatType', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('GAT_NEXT_TYPE', 'GatNextType', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addValidator('GAT_UID', 'maxLength', 'propel.validator.MaxLengthValidator', '32', 'Gateway UID can be no larger than 32 in size');
$tMap->addValidator('GAT_UID', 'required', 'propel.validator.RequiredValidator', '', 'Gateway Element UID is required.');

View File

@@ -76,6 +76,13 @@ abstract class BaseGateway extends BaseObject implements Persistent {
*/
protected $gat_type = '';
/**
* The value for the gat_next_type field.
* @var string
*/
protected $gat_next_type = '';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -167,6 +174,17 @@ abstract class BaseGateway extends BaseObject implements Persistent {
return $this->gat_type;
}
/**
* Get the [gat_next_type] column value.
*
* @return string
*/
public function getGatNextType()
{
return $this->gat_next_type;
}
/**
* Set the value of [gat_uid] column.
*
@@ -321,6 +339,28 @@ abstract class BaseGateway extends BaseObject implements Persistent {
} // setGatType()
/**
* Set the value of [gat_next_type] column.
*
* @param string $v new value
* @return void
*/
public function setGatNextType($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->gat_next_type !== $v || $v === '') {
$this->gat_next_type = $v;
$this->modifiedColumns[] = GatewayPeer::GAT_NEXT_TYPE;
}
} // setGatNextType()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -352,12 +392,14 @@ abstract class BaseGateway extends BaseObject implements Persistent {
$this->gat_type = $rs->getString($startcol + 6);
$this->gat_next_type = $rs->getString($startcol + 7);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 7; // 7 = GatewayPeer::NUM_COLUMNS - GatewayPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 8; // 8 = GatewayPeer::NUM_COLUMNS - GatewayPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating Gateway object", $e);
@@ -581,6 +623,9 @@ abstract class BaseGateway extends BaseObject implements Persistent {
case 6:
return $this->getGatType();
break;
case 7:
return $this->getGatNextType();
break;
default:
return null;
break;
@@ -608,6 +653,7 @@ abstract class BaseGateway extends BaseObject implements Persistent {
$keys[4] => $this->getGatX(),
$keys[5] => $this->getGatY(),
$keys[6] => $this->getGatType(),
$keys[7] => $this->getGatNextType(),
);
return $result;
}
@@ -660,6 +706,9 @@ abstract class BaseGateway extends BaseObject implements Persistent {
case 6:
$this->setGatType($value);
break;
case 7:
$this->setGatNextType($value);
break;
} // switch()
}
@@ -690,6 +739,7 @@ abstract class BaseGateway extends BaseObject implements Persistent {
if (array_key_exists($keys[4], $arr)) $this->setGatX($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setGatY($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setGatType($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setGatNextType($arr[$keys[7]]);
}
/**
@@ -708,6 +758,7 @@ abstract class BaseGateway extends BaseObject implements Persistent {
if ($this->isColumnModified(GatewayPeer::GAT_X)) $criteria->add(GatewayPeer::GAT_X, $this->gat_x);
if ($this->isColumnModified(GatewayPeer::GAT_Y)) $criteria->add(GatewayPeer::GAT_Y, $this->gat_y);
if ($this->isColumnModified(GatewayPeer::GAT_TYPE)) $criteria->add(GatewayPeer::GAT_TYPE, $this->gat_type);
if ($this->isColumnModified(GatewayPeer::GAT_NEXT_TYPE)) $criteria->add(GatewayPeer::GAT_NEXT_TYPE, $this->gat_next_type);
return $criteria;
}
@@ -774,6 +825,8 @@ abstract class BaseGateway extends BaseObject implements Persistent {
$copyObj->setGatType($this->gat_type);
$copyObj->setGatNextType($this->gat_next_type);
$copyObj->setNew(true);

View File

@@ -24,7 +24,7 @@ abstract class BaseGatewayPeer {
const CLASS_DEFAULT = 'classes.model.Gateway';
/** The total number of columns. */
const NUM_COLUMNS = 7;
const NUM_COLUMNS = 8;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -51,6 +51,9 @@ abstract class BaseGatewayPeer {
/** the column name for the GAT_TYPE field */
const GAT_TYPE = 'GATEWAY.GAT_TYPE';
/** the column name for the GAT_NEXT_TYPE field */
const GAT_NEXT_TYPE = 'GATEWAY.GAT_NEXT_TYPE';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -62,10 +65,10 @@ abstract class BaseGatewayPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('GatUid', 'ProUid', 'TasUid', 'GatNextTask', 'GatX', 'GatY', 'GatType', ),
BasePeer::TYPE_COLNAME => array (GatewayPeer::GAT_UID, GatewayPeer::PRO_UID, GatewayPeer::TAS_UID, GatewayPeer::GAT_NEXT_TASK, GatewayPeer::GAT_X, GatewayPeer::GAT_Y, GatewayPeer::GAT_TYPE, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID', 'PRO_UID', 'TAS_UID', 'GAT_NEXT_TASK', 'GAT_X', 'GAT_Y', 'GAT_TYPE', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
BasePeer::TYPE_PHPNAME => array ('GatUid', 'ProUid', 'TasUid', 'GatNextTask', 'GatX', 'GatY', 'GatType', 'GatNextType', ),
BasePeer::TYPE_COLNAME => array (GatewayPeer::GAT_UID, GatewayPeer::PRO_UID, GatewayPeer::TAS_UID, GatewayPeer::GAT_NEXT_TASK, GatewayPeer::GAT_X, GatewayPeer::GAT_Y, GatewayPeer::GAT_TYPE, GatewayPeer::GAT_NEXT_TYPE, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID', 'PRO_UID', 'TAS_UID', 'GAT_NEXT_TASK', 'GAT_X', 'GAT_Y', 'GAT_TYPE', 'GAT_NEXT_TYPE', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -75,10 +78,10 @@ abstract class BaseGatewayPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('GatUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'GatNextTask' => 3, 'GatX' => 4, 'GatY' => 5, 'GatType' => 6, ),
BasePeer::TYPE_COLNAME => array (GatewayPeer::GAT_UID => 0, GatewayPeer::PRO_UID => 1, GatewayPeer::TAS_UID => 2, GatewayPeer::GAT_NEXT_TASK => 3, GatewayPeer::GAT_X => 4, GatewayPeer::GAT_Y => 5, GatewayPeer::GAT_TYPE => 6, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'GAT_NEXT_TASK' => 3, 'GAT_X' => 4, 'GAT_Y' => 5, 'GAT_TYPE' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
BasePeer::TYPE_PHPNAME => array ('GatUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'GatNextTask' => 3, 'GatX' => 4, 'GatY' => 5, 'GatType' => 6, 'GatNextType' => 7, ),
BasePeer::TYPE_COLNAME => array (GatewayPeer::GAT_UID => 0, GatewayPeer::PRO_UID => 1, GatewayPeer::TAS_UID => 2, GatewayPeer::GAT_NEXT_TASK => 3, GatewayPeer::GAT_X => 4, GatewayPeer::GAT_Y => 5, GatewayPeer::GAT_TYPE => 6, GatewayPeer::GAT_NEXT_TYPE => 7, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'GAT_NEXT_TASK' => 3, 'GAT_X' => 4, 'GAT_Y' => 5, 'GAT_TYPE' => 6, 'GAT_NEXT_TYPE' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
);
/**
@@ -193,6 +196,8 @@ abstract class BaseGatewayPeer {
$criteria->addSelectColumn(GatewayPeer::GAT_TYPE);
$criteria->addSelectColumn(GatewayPeer::GAT_NEXT_TYPE);
}
const COUNT = 'COUNT(GATEWAY.GAT_UID)';

View File

@@ -6339,6 +6339,16 @@
<parameter name="Extra" value=""/>
</vendor>
</column>
<column name="GAT_NEXT_TYPE" type="VARCHAR" size="32" required="true" default="">
<vendor type="mysql">
<parameter name="Field" value="GAT_NEXT_TYPE"/>
<parameter name="Type" value="varchar(32)"/>
<parameter name="Null" value="NO"/>
<parameter name="Key" value=""/>
<parameter name="Default" value=""/>
<parameter name="Extra" value=""/>
</vendor>
</column>
<validator column="GAT_UID">
<rule name="maxLength" value="32" message="Gateway UID can be no larger than ${value} in size" />
<rule name="required" message="Gateway Element UID is required." />

View File

@@ -1035,6 +1035,7 @@ CREATE TABLE `GATEWAY`
`GAT_X` INTEGER default 0 NOT NULL,
`GAT_Y` INTEGER default 0 NOT NULL,
`GAT_TYPE` VARCHAR(32) default '' NOT NULL,
`GAT_NEXT_TYPE` VARCHAR(32) default '' NOT NULL,
PRIMARY KEY (`GAT_UID`)
)Type=MyISAM ;
#-----------------------------------------------------------------------------