This commit is contained in:
Dante
2015-12-20 13:56:19 -04:00
parent ccb37341f1
commit 5e337a0dbc
5 changed files with 180 additions and 75 deletions

View File

@@ -65,7 +65,9 @@ class GmailRelabelingMapBuilder
$tMap->setUseIdGenerator(false); $tMap->setUseIdGenerator(false);
$tMap->addColumn('CREATE_DATE', 'CreateDate', 'int', CreoleTypes::TIMESTAMP, false, null); $tMap->addPrimaryKey('LABELING_UID', 'LabelingUid', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('CREATE_DATE', 'CreateDate', 'int', CreoleTypes::TIMESTAMP, true, null);
$tMap->addColumn('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32); $tMap->addColumn('APP_UID', 'AppUid', 'string', CreoleTypes::VARCHAR, true, 32);

View File

@@ -27,6 +27,12 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
*/ */
protected static $peer; protected static $peer;
/**
* The value for the labeling_uid field.
* @var int
*/
protected $labeling_uid;
/** /**
* The value for the create_date field. * The value for the create_date field.
* @var int * @var int
@@ -83,6 +89,17 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
*/ */
protected $alreadyInValidation = false; protected $alreadyInValidation = false;
/**
* Get the [labeling_uid] column value.
*
* @return int
*/
public function getLabelingUid()
{
return $this->labeling_uid;
}
/** /**
* Get the [optionally formatted] [create_date] column value. * Get the [optionally formatted] [create_date] column value.
* *
@@ -181,6 +198,28 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
return $this->msg_error; return $this->msg_error;
} }
/**
* Set the value of [labeling_uid] column.
*
* @param int $v new value
* @return void
*/
public function setLabelingUid($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->labeling_uid !== $v) {
$this->labeling_uid = $v;
$this->modifiedColumns[] = GmailRelabelingPeer::LABELING_UID;
}
} // setLabelingUid()
/** /**
* Set the value of [create_date] column. * Set the value of [create_date] column.
* *
@@ -359,26 +398,28 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
{ {
try { try {
$this->create_date = $rs->getTimestamp($startcol + 0, null); $this->labeling_uid = $rs->getInt($startcol + 0);
$this->app_uid = $rs->getString($startcol + 1); $this->create_date = $rs->getTimestamp($startcol + 1, null);
$this->del_index = $rs->getInt($startcol + 2); $this->app_uid = $rs->getString($startcol + 2);
$this->current_last_index = $rs->getInt($startcol + 3); $this->del_index = $rs->getInt($startcol + 3);
$this->unassigned = $rs->getInt($startcol + 4); $this->current_last_index = $rs->getInt($startcol + 4);
$this->status = $rs->getString($startcol + 5); $this->unassigned = $rs->getInt($startcol + 5);
$this->msg_error = $rs->getString($startcol + 6); $this->status = $rs->getString($startcol + 6);
$this->msg_error = $rs->getString($startcol + 7);
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer. // FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 7; // 7 = GmailRelabelingPeer::NUM_COLUMNS - GmailRelabelingPeer::NUM_LAZY_LOAD_COLUMNS). return $startcol + 8; // 8 = GmailRelabelingPeer::NUM_COLUMNS - GmailRelabelingPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating GmailRelabeling object", $e); throw new PropelException("Error populating GmailRelabeling object", $e);
@@ -583,24 +624,27 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
{ {
switch($pos) { switch($pos) {
case 0: case 0:
return $this->getCreateDate(); return $this->getLabelingUid();
break; break;
case 1: case 1:
return $this->getAppUid(); return $this->getCreateDate();
break; break;
case 2: case 2:
return $this->getDelIndex(); return $this->getAppUid();
break; break;
case 3: case 3:
return $this->getCurrentLastIndex(); return $this->getDelIndex();
break; break;
case 4: case 4:
return $this->getUnassigned(); return $this->getCurrentLastIndex();
break; break;
case 5: case 5:
return $this->getStatus(); return $this->getUnassigned();
break; break;
case 6: case 6:
return $this->getStatus();
break;
case 7:
return $this->getMsgError(); return $this->getMsgError();
break; break;
default: default:
@@ -623,13 +667,14 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
{ {
$keys = GmailRelabelingPeer::getFieldNames($keyType); $keys = GmailRelabelingPeer::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getCreateDate(), $keys[0] => $this->getLabelingUid(),
$keys[1] => $this->getAppUid(), $keys[1] => $this->getCreateDate(),
$keys[2] => $this->getDelIndex(), $keys[2] => $this->getAppUid(),
$keys[3] => $this->getCurrentLastIndex(), $keys[3] => $this->getDelIndex(),
$keys[4] => $this->getUnassigned(), $keys[4] => $this->getCurrentLastIndex(),
$keys[5] => $this->getStatus(), $keys[5] => $this->getUnassigned(),
$keys[6] => $this->getMsgError(), $keys[6] => $this->getStatus(),
$keys[7] => $this->getMsgError(),
); );
return $result; return $result;
} }
@@ -662,24 +707,27 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
{ {
switch($pos) { switch($pos) {
case 0: case 0:
$this->setCreateDate($value); $this->setLabelingUid($value);
break; break;
case 1: case 1:
$this->setAppUid($value); $this->setCreateDate($value);
break; break;
case 2: case 2:
$this->setDelIndex($value); $this->setAppUid($value);
break; break;
case 3: case 3:
$this->setCurrentLastIndex($value); $this->setDelIndex($value);
break; break;
case 4: case 4:
$this->setUnassigned($value); $this->setCurrentLastIndex($value);
break; break;
case 5: case 5:
$this->setStatus($value); $this->setUnassigned($value);
break; break;
case 6: case 6:
$this->setStatus($value);
break;
case 7:
$this->setMsgError($value); $this->setMsgError($value);
break; break;
} // switch() } // switch()
@@ -706,31 +754,35 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
$keys = GmailRelabelingPeer::getFieldNames($keyType); $keys = GmailRelabelingPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) { if (array_key_exists($keys[0], $arr)) {
$this->setCreateDate($arr[$keys[0]]); $this->setLabelingUid($arr[$keys[0]]);
} }
if (array_key_exists($keys[1], $arr)) { if (array_key_exists($keys[1], $arr)) {
$this->setAppUid($arr[$keys[1]]); $this->setCreateDate($arr[$keys[1]]);
} }
if (array_key_exists($keys[2], $arr)) { if (array_key_exists($keys[2], $arr)) {
$this->setDelIndex($arr[$keys[2]]); $this->setAppUid($arr[$keys[2]]);
} }
if (array_key_exists($keys[3], $arr)) { if (array_key_exists($keys[3], $arr)) {
$this->setCurrentLastIndex($arr[$keys[3]]); $this->setDelIndex($arr[$keys[3]]);
} }
if (array_key_exists($keys[4], $arr)) { if (array_key_exists($keys[4], $arr)) {
$this->setUnassigned($arr[$keys[4]]); $this->setCurrentLastIndex($arr[$keys[4]]);
} }
if (array_key_exists($keys[5], $arr)) { if (array_key_exists($keys[5], $arr)) {
$this->setStatus($arr[$keys[5]]); $this->setUnassigned($arr[$keys[5]]);
} }
if (array_key_exists($keys[6], $arr)) { if (array_key_exists($keys[6], $arr)) {
$this->setMsgError($arr[$keys[6]]); $this->setStatus($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
$this->setMsgError($arr[$keys[7]]);
} }
} }
@@ -744,6 +796,10 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
{ {
$criteria = new Criteria(GmailRelabelingPeer::DATABASE_NAME); $criteria = new Criteria(GmailRelabelingPeer::DATABASE_NAME);
if ($this->isColumnModified(GmailRelabelingPeer::LABELING_UID)) {
$criteria->add(GmailRelabelingPeer::LABELING_UID, $this->labeling_uid);
}
if ($this->isColumnModified(GmailRelabelingPeer::CREATE_DATE)) { if ($this->isColumnModified(GmailRelabelingPeer::CREATE_DATE)) {
$criteria->add(GmailRelabelingPeer::CREATE_DATE, $this->create_date); $criteria->add(GmailRelabelingPeer::CREATE_DATE, $this->create_date);
} }
@@ -788,33 +844,30 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
{ {
$criteria = new Criteria(GmailRelabelingPeer::DATABASE_NAME); $criteria = new Criteria(GmailRelabelingPeer::DATABASE_NAME);
$criteria->add(GmailRelabelingPeer::LABELING_UID, $this->labeling_uid);
return $criteria; return $criteria;
} }
/** /**
* Returns NULL since this table doesn't have a primary key. * Returns the primary key for this object (row).
* This method exists only for BC and is deprecated! * @return int
* @return null
*/ */
public function getPrimaryKey() public function getPrimaryKey()
{ {
return null; return $this->getLabelingUid();
} }
/** /**
* Dummy primary key setter. * Generic method to set the primary key (labeling_uid column).
* *
* This function only exists to preserve backwards compatibility. It is no longer * @param int $key Primary key.
* needed or required by the Persistent interface. It will be removed in next BC-breaking * @return void
* release of Propel.
*
* @deprecated
*/ */
public function setPrimaryKey($pk) public function setPrimaryKey($key)
{ {
// do nothing, because this object doesn't have any primary keys $this->setLabelingUid($key);
} }
/** /**
* Sets contents of passed object to values from current object. * Sets contents of passed object to values from current object.
@@ -846,6 +899,8 @@ abstract class BaseGmailRelabeling extends BaseObject implements Persistent
$copyObj->setNew(true); $copyObj->setNew(true);
$copyObj->setLabelingUid(NULL); // this is a pkey column, so set to default value
} }
/** /**

View File

@@ -25,12 +25,15 @@ abstract class BaseGmailRelabelingPeer
const CLASS_DEFAULT = 'classes.model.GmailRelabeling'; const CLASS_DEFAULT = 'classes.model.GmailRelabeling';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 7; const NUM_COLUMNS = 8;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the LABELING_UID field */
const LABELING_UID = 'GMAIL_RELABELING.LABELING_UID';
/** the column name for the CREATE_DATE field */ /** the column name for the CREATE_DATE field */
const CREATE_DATE = 'GMAIL_RELABELING.CREATE_DATE'; const CREATE_DATE = 'GMAIL_RELABELING.CREATE_DATE';
@@ -63,10 +66,10 @@ abstract class BaseGmailRelabelingPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('CreateDate', 'AppUid', 'DelIndex', 'CurrentLastIndex', 'Unassigned', 'Status', 'MsgError', ), BasePeer::TYPE_PHPNAME => array ('LabelingUid', 'CreateDate', 'AppUid', 'DelIndex', 'CurrentLastIndex', 'Unassigned', 'Status', 'MsgError', ),
BasePeer::TYPE_COLNAME => array (GmailRelabelingPeer::CREATE_DATE, GmailRelabelingPeer::APP_UID, GmailRelabelingPeer::DEL_INDEX, GmailRelabelingPeer::CURRENT_LAST_INDEX, GmailRelabelingPeer::UNASSIGNED, GmailRelabelingPeer::STATUS, GmailRelabelingPeer::MSG_ERROR, ), BasePeer::TYPE_COLNAME => array (GmailRelabelingPeer::LABELING_UID, GmailRelabelingPeer::CREATE_DATE, GmailRelabelingPeer::APP_UID, GmailRelabelingPeer::DEL_INDEX, GmailRelabelingPeer::CURRENT_LAST_INDEX, GmailRelabelingPeer::UNASSIGNED, GmailRelabelingPeer::STATUS, GmailRelabelingPeer::MSG_ERROR, ),
BasePeer::TYPE_FIELDNAME => array ('CREATE_DATE', 'APP_UID', 'DEL_INDEX', 'CURRENT_LAST_INDEX', 'UNASSIGNED', 'STATUS', 'MSG_ERROR', ), BasePeer::TYPE_FIELDNAME => array ('LABELING_UID', 'CREATE_DATE', 'APP_UID', 'DEL_INDEX', 'CURRENT_LAST_INDEX', 'UNASSIGNED', 'STATUS', 'MSG_ERROR', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
); );
/** /**
@@ -76,10 +79,10 @@ abstract class BaseGmailRelabelingPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('CreateDate' => 0, 'AppUid' => 1, 'DelIndex' => 2, 'CurrentLastIndex' => 3, 'Unassigned' => 4, 'Status' => 5, 'MsgError' => 6, ), BasePeer::TYPE_PHPNAME => array ('LabelingUid' => 0, 'CreateDate' => 1, 'AppUid' => 2, 'DelIndex' => 3, 'CurrentLastIndex' => 4, 'Unassigned' => 5, 'Status' => 6, 'MsgError' => 7, ),
BasePeer::TYPE_COLNAME => array (GmailRelabelingPeer::CREATE_DATE => 0, GmailRelabelingPeer::APP_UID => 1, GmailRelabelingPeer::DEL_INDEX => 2, GmailRelabelingPeer::CURRENT_LAST_INDEX => 3, GmailRelabelingPeer::UNASSIGNED => 4, GmailRelabelingPeer::STATUS => 5, GmailRelabelingPeer::MSG_ERROR => 6, ), BasePeer::TYPE_COLNAME => array (GmailRelabelingPeer::LABELING_UID => 0, GmailRelabelingPeer::CREATE_DATE => 1, GmailRelabelingPeer::APP_UID => 2, GmailRelabelingPeer::DEL_INDEX => 3, GmailRelabelingPeer::CURRENT_LAST_INDEX => 4, GmailRelabelingPeer::UNASSIGNED => 5, GmailRelabelingPeer::STATUS => 6, GmailRelabelingPeer::MSG_ERROR => 7, ),
BasePeer::TYPE_FIELDNAME => array ('CREATE_DATE' => 0, 'APP_UID' => 1, 'DEL_INDEX' => 2, 'CURRENT_LAST_INDEX' => 3, 'UNASSIGNED' => 4, 'STATUS' => 5, 'MSG_ERROR' => 6, ), BasePeer::TYPE_FIELDNAME => array ('LABELING_UID' => 0, 'CREATE_DATE' => 1, 'APP_UID' => 2, 'DEL_INDEX' => 3, 'CURRENT_LAST_INDEX' => 4, 'UNASSIGNED' => 5, 'STATUS' => 6, 'MSG_ERROR' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
); );
/** /**
@@ -180,6 +183,8 @@ abstract class BaseGmailRelabelingPeer
public static function addSelectColumns(Criteria $criteria) public static function addSelectColumns(Criteria $criteria)
{ {
$criteria->addSelectColumn(GmailRelabelingPeer::LABELING_UID);
$criteria->addSelectColumn(GmailRelabelingPeer::CREATE_DATE); $criteria->addSelectColumn(GmailRelabelingPeer::CREATE_DATE);
$criteria->addSelectColumn(GmailRelabelingPeer::APP_UID); $criteria->addSelectColumn(GmailRelabelingPeer::APP_UID);
@@ -196,8 +201,8 @@ abstract class BaseGmailRelabelingPeer
} }
const COUNT = 'COUNT(*)'; const COUNT = 'COUNT(GMAIL_RELABELING.LABELING_UID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT *)'; const COUNT_DISTINCT = 'COUNT(DISTINCT GMAIL_RELABELING.LABELING_UID)';
/** /**
* Returns the number of rows matching criteria. * Returns the number of rows matching criteria.
@@ -406,6 +411,9 @@ abstract class BaseGmailRelabelingPeer
if ($values instanceof Criteria) { if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity $criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(GmailRelabelingPeer::LABELING_UID);
$selectCriteria->add(GmailRelabelingPeer::LABELING_UID, $criteria->remove(GmailRelabelingPeer::LABELING_UID), $comparison);
} else { } else {
$criteria = $values->buildCriteria(); // gets full criteria $criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s) $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
@@ -463,22 +471,11 @@ abstract class BaseGmailRelabelingPeer
$criteria = clone $values; // rename for clarity $criteria = clone $values; // rename for clarity
} elseif ($values instanceof GmailRelabeling) { } elseif ($values instanceof GmailRelabeling) {
$criteria = $values->buildCriteria(); $criteria = $values->buildPkeyCriteria();
} else { } else {
// it must be the primary key // it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME); $criteria = new Criteria(self::DATABASE_NAME);
// primary key is composite; we therefore, expect $criteria->add(GmailRelabelingPeer::LABELING_UID, (array) $values, Criteria::IN);
// the primary key passed to be an array of pkey
// values
if (count($values) == count($values, COUNT_RECURSIVE)) {
// array is not multi-dimensional
$values = array($values);
}
$vals = array();
foreach ($values as $value) {
}
} }
// Set the correct dbName // Set the correct dbName
@@ -536,6 +533,54 @@ abstract class BaseGmailRelabelingPeer
return BasePeer::doValidate(GmailRelabelingPeer::DATABASE_NAME, GmailRelabelingPeer::TABLE_NAME, $columns); return BasePeer::doValidate(GmailRelabelingPeer::DATABASE_NAME, GmailRelabelingPeer::TABLE_NAME, $columns);
} }
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return GmailRelabeling
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(GmailRelabelingPeer::DATABASE_NAME);
$criteria->add(GmailRelabelingPeer::LABELING_UID, $pk);
$v = GmailRelabelingPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(GmailRelabelingPeer::LABELING_UID, $pks, Criteria::IN);
$objs = GmailRelabelingPeer::doSelect($criteria, $con);
}
return $objs;
}
} }

View File

@@ -5261,7 +5261,8 @@
<parameter name="Create_options" value="" /> <parameter name="Create_options" value="" />
<parameter name="Comment" value="Task for label relabaling"/> <parameter name="Comment" value="Task for label relabaling"/>
</vendor> </vendor>
<column name="CREATE_DATE" type="TIMESTAMP" required="false"/> <column name="LABELING_UID" type="INTEGER" required="true" autoIncrement="true" primaryKey="true"/>
<column name="CREATE_DATE" type="TIMESTAMP" required="true"/>
<column name="APP_UID" type="VARCHAR" size="32" required="true" default=""/> <column name="APP_UID" type="VARCHAR" size="32" required="true" default=""/>
<column name="DEL_INDEX" type="INTEGER" required="true" default="0"/> <column name="DEL_INDEX" type="INTEGER" required="true" default="0"/>
<column name="CURRENT_LAST_INDEX" type="INTEGER" required="true" default="0"/> <column name="CURRENT_LAST_INDEX" type="INTEGER" required="true" default="0"/>

View File

@@ -2938,13 +2938,15 @@ CREATE TABLE `NOTIFICATION_DEVICE`
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
CREATE TABLE `GMAIL_RELABELING` ( CREATE TABLE `GMAIL_RELABELING` (
`CREATE_DATE` DATETIME NOT NULL DEFAULT '', `LABELING_ID` INTEGER NOT NULL AUTO_INCREMENT,
`CREATE_DATE` DATETIME NOT NULL DEFAULT '',
`APP_UID` VARCHAR(32) NOT NULL DEFAULT '', `APP_UID` VARCHAR(32) NOT NULL DEFAULT '',
`DEL_INDEX` INT(11) NOT NULL DEFAULT '0', `DEL_INDEX` INT(11) NOT NULL DEFAULT '0',
`CURRENT_LAST_INDEX` INT(11) NOT NULL DEFAULT '0', `CURRENT_LAST_INDEX` INT(11) NOT NULL DEFAULT '0',
`UNASSIGNED` INT(11) NOT NULL DEFAULT '0', `UNASSIGNED` INT(11) NOT NULL DEFAULT '0',
`STATUS` VARCHAR(32) NOT NULL DEFAULT 'pending', `STATUS` VARCHAR(32) NOT NULL DEFAULT 'pending',
`MSG_ERROR` TEXT NULL, `MSG_ERROR` TEXT NULL,
PRIMARY KEY (`LABELING_ID`),
KEY `indexStatus` (`STATUS`) KEY `indexStatus` (`STATUS`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Task to synchronize Gmail Labels'; )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Task to synchronize Gmail Labels';
# This restores the fkey checks, after having unset them earlier # This restores the fkey checks, after having unset them earlier