This commit is contained in:
Julio Cesar Laura Avendaño
2016-10-20 16:00:08 -04:00
parent 6384d57960
commit 761402ca42
6 changed files with 28 additions and 36 deletions

View File

@@ -27,26 +27,19 @@ class LoginLog extends BaseLoginLog
*/
public function create($aData)
{
$con = Propel::getConnection("workflow");
$con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
try {
$tableName = 'LOGIN_LOG';
$columns = array('LOG_UID', 'LOG_STATUS', 'LOG_IP', 'LOG_SID', 'LOG_INIT_DATE', 'LOG_CLIENT_HOSTNAME', 'USR_UID');
$sql = "INSERT INTO " . $tableName
. " (" . implode(",", $columns) . ")"
. " VALUES ("
. "'" . $aData['LOG_UID'] . "'" . ','
. "'" . $aData['LOG_STATUS'] . "'" . ','
. "'" . $aData['LOG_IP'] . "'" . ','
. "'" . $aData['LOG_SID'] . "'" . ','
. "'" . $aData['LOG_INIT_DATE'] . "'" . ','
. "'" . $aData['LOG_CLIENT_HOSTNAME'] . "'" . ','
. "'" . $aData['USR_UID'] . "'" .
")";
$stmt = $con->createStatement();
$stmt->executeQuery($sql);
return true;
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$con->begin();
$result = $this->save();
$con->commit();
} else {
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $this->getValidationFailures();
throw ($e);
}
return $result;
} catch (Exception $e) {
$con->rollback();
throw ($e);
@@ -75,7 +68,7 @@ class LoginLog extends BaseLoginLog
$con = Propel::getConnection( LoginLogPeer::DATABASE_NAME );
try {
$con->begin();
$this->load( $fields['LOG_UID'] );
$this->load( $fields['LOG_ID'] );
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$result = $this->save();

View File

@@ -24,20 +24,6 @@
*/
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;
}
}