egeneracion propel-build-model para tabla Login Log.

This commit is contained in:
Dheeyi William
2016-09-19 10:26:03 -04:00
parent 948e12a6b1
commit 7cf1d7e794
4 changed files with 148 additions and 64 deletions

View File

@@ -24,5 +24,20 @@
*/
class LoginLogPeer extends BaseLoginLogPeer
{
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(LoginLogPeer::DATABASE_NAME);
$criteria->add(LoginLogPeer::LOG_UID, $pk);
$v = LoginLogPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
}

View File

@@ -63,9 +63,11 @@ class LoginLogMapBuilder
$tMap = $this->dbMap->addTable('LOGIN_LOG');
$tMap->setPhpName('LoginLog');
$tMap->setUseIdGenerator(false);
$tMap->setUseIdGenerator(true);
$tMap->addPrimaryKey('LOG_UID', 'LogUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addPrimaryKey('LOG_ID', 'LogId', 'int', CreoleTypes::INTEGER, true, null);
$tMap->addColumn('LOG_UID', 'LogUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('LOG_STATUS', 'LogStatus', 'string', CreoleTypes::VARCHAR, true, 100);

View File

@@ -27,6 +27,12 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
*/
protected static $peer;
/**
* The value for the log_id field.
* @var int
*/
protected $log_id;
/**
* The value for the log_uid field.
* @var string
@@ -89,6 +95,17 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
*/
protected $alreadyInValidation = false;
/**
* Get the [log_id] column value.
*
* @return int
*/
public function getLogId()
{
return $this->log_id;
}
/**
* Get the [log_uid] column value.
*
@@ -219,6 +236,28 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
return $this->usr_uid;
}
/**
* Set the value of [log_id] column.
*
* @param int $v new value
* @return void
*/
public function setLogId($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->log_id !== $v) {
$this->log_id = $v;
$this->modifiedColumns[] = LoginLogPeer::LOG_ID;
}
} // setLogId()
/**
* Set the value of [log_uid] column.
*
@@ -426,28 +465,30 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
{
try {
$this->log_uid = $rs->getString($startcol + 0);
$this->log_id = $rs->getInt($startcol + 0);
$this->log_status = $rs->getString($startcol + 1);
$this->log_uid = $rs->getString($startcol + 1);
$this->log_ip = $rs->getString($startcol + 2);
$this->log_status = $rs->getString($startcol + 2);
$this->log_sid = $rs->getString($startcol + 3);
$this->log_ip = $rs->getString($startcol + 3);
$this->log_init_date = $rs->getTimestamp($startcol + 4, null);
$this->log_sid = $rs->getString($startcol + 4);
$this->log_end_date = $rs->getTimestamp($startcol + 5, null);
$this->log_init_date = $rs->getTimestamp($startcol + 5, null);
$this->log_client_hostname = $rs->getString($startcol + 6);
$this->log_end_date = $rs->getTimestamp($startcol + 6, null);
$this->usr_uid = $rs->getString($startcol + 7);
$this->log_client_hostname = $rs->getString($startcol + 7);
$this->usr_uid = $rs->getString($startcol + 8);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 8; // 8 = LoginLogPeer::NUM_COLUMNS - LoginLogPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 9; // 9 = LoginLogPeer::NUM_COLUMNS - LoginLogPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating LoginLog object", $e);
@@ -541,6 +582,8 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setLogId($pk); //[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += LoginLogPeer::doUpdate($this, $con);
@@ -652,27 +695,30 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
{
switch($pos) {
case 0:
return $this->getLogUid();
return $this->getLogId();
break;
case 1:
return $this->getLogStatus();
return $this->getLogUid();
break;
case 2:
return $this->getLogIp();
return $this->getLogStatus();
break;
case 3:
return $this->getLogSid();
return $this->getLogIp();
break;
case 4:
return $this->getLogInitDate();
return $this->getLogSid();
break;
case 5:
return $this->getLogEndDate();
return $this->getLogInitDate();
break;
case 6:
return $this->getLogClientHostname();
return $this->getLogEndDate();
break;
case 7:
return $this->getLogClientHostname();
break;
case 8:
return $this->getUsrUid();
break;
default:
@@ -695,14 +741,15 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
{
$keys = LoginLogPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getLogUid(),
$keys[1] => $this->getLogStatus(),
$keys[2] => $this->getLogIp(),
$keys[3] => $this->getLogSid(),
$keys[4] => $this->getLogInitDate(),
$keys[5] => $this->getLogEndDate(),
$keys[6] => $this->getLogClientHostname(),
$keys[7] => $this->getUsrUid(),
$keys[0] => $this->getLogId(),
$keys[1] => $this->getLogUid(),
$keys[2] => $this->getLogStatus(),
$keys[3] => $this->getLogIp(),
$keys[4] => $this->getLogSid(),
$keys[5] => $this->getLogInitDate(),
$keys[6] => $this->getLogEndDate(),
$keys[7] => $this->getLogClientHostname(),
$keys[8] => $this->getUsrUid(),
);
return $result;
}
@@ -735,27 +782,30 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
{
switch($pos) {
case 0:
$this->setLogUid($value);
$this->setLogId($value);
break;
case 1:
$this->setLogStatus($value);
$this->setLogUid($value);
break;
case 2:
$this->setLogIp($value);
$this->setLogStatus($value);
break;
case 3:
$this->setLogSid($value);
$this->setLogIp($value);
break;
case 4:
$this->setLogInitDate($value);
$this->setLogSid($value);
break;
case 5:
$this->setLogEndDate($value);
$this->setLogInitDate($value);
break;
case 6:
$this->setLogClientHostname($value);
$this->setLogEndDate($value);
break;
case 7:
$this->setLogClientHostname($value);
break;
case 8:
$this->setUsrUid($value);
break;
} // switch()
@@ -782,35 +832,39 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
$keys = LoginLogPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setLogUid($arr[$keys[0]]);
$this->setLogId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setLogStatus($arr[$keys[1]]);
$this->setLogUid($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setLogIp($arr[$keys[2]]);
$this->setLogStatus($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setLogSid($arr[$keys[3]]);
$this->setLogIp($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setLogInitDate($arr[$keys[4]]);
$this->setLogSid($arr[$keys[4]]);
}
if (array_key_exists($keys[5], $arr)) {
$this->setLogEndDate($arr[$keys[5]]);
$this->setLogInitDate($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
$this->setLogClientHostname($arr[$keys[6]]);
$this->setLogEndDate($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
$this->setUsrUid($arr[$keys[7]]);
$this->setLogClientHostname($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
$this->setUsrUid($arr[$keys[8]]);
}
}
@@ -824,6 +878,10 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
{
$criteria = new Criteria(LoginLogPeer::DATABASE_NAME);
if ($this->isColumnModified(LoginLogPeer::LOG_ID)) {
$criteria->add(LoginLogPeer::LOG_ID, $this->log_id);
}
if ($this->isColumnModified(LoginLogPeer::LOG_UID)) {
$criteria->add(LoginLogPeer::LOG_UID, $this->log_uid);
}
@@ -872,29 +930,29 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
{
$criteria = new Criteria(LoginLogPeer::DATABASE_NAME);
$criteria->add(LoginLogPeer::LOG_UID, $this->log_uid);
$criteria->add(LoginLogPeer::LOG_ID, $this->log_id);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return string
* @return int
*/
public function getPrimaryKey()
{
return $this->getLogUid();
return $this->getLogId();
}
/**
* Generic method to set the primary key (log_uid column).
* Generic method to set the primary key (log_id column).
*
* @param string $key Primary key.
* @param int $key Primary key.
* @return void
*/
public function setPrimaryKey($key)
{
$this->setLogUid($key);
$this->setLogId($key);
}
/**
@@ -910,6 +968,8 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setLogUid($this->log_uid);
$copyObj->setLogStatus($this->log_status);
$copyObj->setLogIp($this->log_ip);
@@ -927,7 +987,7 @@ abstract class BaseLoginLog extends BaseObject implements Persistent
$copyObj->setNew(true);
$copyObj->setLogUid(''); // this is a pkey column, so set to default value
$copyObj->setLogId(NULL); // this is a pkey column, so set to default value
}

View File

@@ -25,12 +25,15 @@ abstract class BaseLoginLogPeer
const CLASS_DEFAULT = 'classes.model.LoginLog';
/** The total number of columns. */
const NUM_COLUMNS = 8;
const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the LOG_ID field */
const LOG_ID = 'LOGIN_LOG.LOG_ID';
/** the column name for the LOG_UID field */
const LOG_UID = 'LOGIN_LOG.LOG_UID';
@@ -66,10 +69,10 @@ abstract class BaseLoginLogPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('LogUid', 'LogStatus', 'LogIp', 'LogSid', 'LogInitDate', 'LogEndDate', 'LogClientHostname', 'UsrUid', ),
BasePeer::TYPE_COLNAME => array (LoginLogPeer::LOG_UID, LoginLogPeer::LOG_STATUS, LoginLogPeer::LOG_IP, LoginLogPeer::LOG_SID, LoginLogPeer::LOG_INIT_DATE, LoginLogPeer::LOG_END_DATE, LoginLogPeer::LOG_CLIENT_HOSTNAME, LoginLogPeer::USR_UID, ),
BasePeer::TYPE_FIELDNAME => array ('LOG_UID', 'LOG_STATUS', 'LOG_IP', 'LOG_SID', 'LOG_INIT_DATE', 'LOG_END_DATE', 'LOG_CLIENT_HOSTNAME', 'USR_UID', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
BasePeer::TYPE_PHPNAME => array ('LogId', 'LogUid', 'LogStatus', 'LogIp', 'LogSid', 'LogInitDate', 'LogEndDate', 'LogClientHostname', 'UsrUid', ),
BasePeer::TYPE_COLNAME => array (LoginLogPeer::LOG_ID, LoginLogPeer::LOG_UID, LoginLogPeer::LOG_STATUS, LoginLogPeer::LOG_IP, LoginLogPeer::LOG_SID, LoginLogPeer::LOG_INIT_DATE, LoginLogPeer::LOG_END_DATE, LoginLogPeer::LOG_CLIENT_HOSTNAME, LoginLogPeer::USR_UID, ),
BasePeer::TYPE_FIELDNAME => array ('LOG_ID', 'LOG_UID', 'LOG_STATUS', 'LOG_IP', 'LOG_SID', 'LOG_INIT_DATE', 'LOG_END_DATE', 'LOG_CLIENT_HOSTNAME', 'USR_UID', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -79,10 +82,10 @@ abstract class BaseLoginLogPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('LogUid' => 0, 'LogStatus' => 1, 'LogIp' => 2, 'LogSid' => 3, 'LogInitDate' => 4, 'LogEndDate' => 5, 'LogClientHostname' => 6, 'UsrUid' => 7, ),
BasePeer::TYPE_COLNAME => array (LoginLogPeer::LOG_UID => 0, LoginLogPeer::LOG_STATUS => 1, LoginLogPeer::LOG_IP => 2, LoginLogPeer::LOG_SID => 3, LoginLogPeer::LOG_INIT_DATE => 4, LoginLogPeer::LOG_END_DATE => 5, LoginLogPeer::LOG_CLIENT_HOSTNAME => 6, LoginLogPeer::USR_UID => 7, ),
BasePeer::TYPE_FIELDNAME => array ('LOG_UID' => 0, 'LOG_STATUS' => 1, 'LOG_IP' => 2, 'LOG_SID' => 3, 'LOG_INIT_DATE' => 4, 'LOG_END_DATE' => 5, 'LOG_CLIENT_HOSTNAME' => 6, 'USR_UID' => 7, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
BasePeer::TYPE_PHPNAME => array ('LogId' => 0, 'LogUid' => 1, 'LogStatus' => 2, 'LogIp' => 3, 'LogSid' => 4, 'LogInitDate' => 5, 'LogEndDate' => 6, 'LogClientHostname' => 7, 'UsrUid' => 8, ),
BasePeer::TYPE_COLNAME => array (LoginLogPeer::LOG_ID => 0, LoginLogPeer::LOG_UID => 1, LoginLogPeer::LOG_STATUS => 2, LoginLogPeer::LOG_IP => 3, LoginLogPeer::LOG_SID => 4, LoginLogPeer::LOG_INIT_DATE => 5, LoginLogPeer::LOG_END_DATE => 6, LoginLogPeer::LOG_CLIENT_HOSTNAME => 7, LoginLogPeer::USR_UID => 8, ),
BasePeer::TYPE_FIELDNAME => array ('LOG_ID' => 0, 'LOG_UID' => 1, 'LOG_STATUS' => 2, 'LOG_IP' => 3, 'LOG_SID' => 4, 'LOG_INIT_DATE' => 5, 'LOG_END_DATE' => 6, 'LOG_CLIENT_HOSTNAME' => 7, 'USR_UID' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -183,6 +186,8 @@ abstract class BaseLoginLogPeer
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(LoginLogPeer::LOG_ID);
$criteria->addSelectColumn(LoginLogPeer::LOG_UID);
$criteria->addSelectColumn(LoginLogPeer::LOG_STATUS);
@@ -201,8 +206,8 @@ abstract class BaseLoginLogPeer
}
const COUNT = 'COUNT(LOGIN_LOG.LOG_UID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT LOGIN_LOG.LOG_UID)';
const COUNT = 'COUNT(LOGIN_LOG.LOG_ID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT LOGIN_LOG.LOG_ID)';
/**
* Returns the number of rows matching criteria.
@@ -373,6 +378,8 @@ abstract class BaseLoginLogPeer
$criteria = $values->buildCriteria(); // build Criteria from LoginLog object
}
//$criteria->remove(LoginLogPeer::LOG_ID); // remove pkey col since this table uses auto-increment
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
@@ -411,8 +418,8 @@ abstract class BaseLoginLogPeer
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(LoginLogPeer::LOG_UID);
$selectCriteria->add(LoginLogPeer::LOG_UID, $criteria->remove(LoginLogPeer::LOG_UID), $comparison);
$comparison = $criteria->getComparison(LoginLogPeer::LOG_ID);
$selectCriteria->add(LoginLogPeer::LOG_ID, $criteria->remove(LoginLogPeer::LOG_ID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
@@ -475,7 +482,7 @@ abstract class BaseLoginLogPeer
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(LoginLogPeer::LOG_UID, (array) $values, Criteria::IN);
$criteria->add(LoginLogPeer::LOG_ID, (array) $values, Criteria::IN);
}
// Set the correct dbName
@@ -549,7 +556,7 @@ abstract class BaseLoginLogPeer
$criteria = new Criteria(LoginLogPeer::DATABASE_NAME);
$criteria->add(LoginLogPeer::LOG_UID, $pk);
$criteria->add(LoginLogPeer::LOG_ID, $pk);
$v = LoginLogPeer::doSelect($criteria, $con);
@@ -576,7 +583,7 @@ abstract class BaseLoginLogPeer
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(LoginLogPeer::LOG_UID, $pks, Criteria::IN);
$criteria->add(LoginLogPeer::LOG_ID, $pks, Criteria::IN);
$objs = LoginLogPeer::doSelect($criteria, $con);
}
return $objs;