Files
portal-legacy/lib/model/om/BaseQualifications.php

583 lines
11 KiB
PHP
Raw Normal View History

2012-11-28 03:55:08 -05:00
<?php
abstract class BaseQualifications extends BaseObject implements Persistent {
protected static $peer;
protected $id;
protected $user_id;
protected $device_id;
protected $created_at;
protected $updated_at;
protected $aUser;
protected $aDevice;
protected $alreadyInSave = false;
protected $alreadyInValidation = false;
public function getId()
{
return $this->id;
}
public function getUserId()
{
return $this->user_id;
}
public function getDeviceId()
{
return $this->device_id;
}
public function getCreatedAt($format = 'Y-m-d H:i:s')
{
if ($this->created_at === null || $this->created_at === '') {
return null;
} elseif (!is_int($this->created_at)) {
$ts = strtotime($this->created_at);
if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
}
} else {
$ts = $this->created_at;
}
if ($format === null) {
return $ts;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $ts);
} else {
return date($format, $ts);
}
}
public function getUpdatedAt($format = 'Y-m-d H:i:s')
{
if ($this->updated_at === null || $this->updated_at === '') {
return null;
} elseif (!is_int($this->updated_at)) {
$ts = strtotime($this->updated_at);
if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
}
} else {
$ts = $this->updated_at;
}
if ($format === null) {
return $ts;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $ts);
} else {
return date($format, $ts);
}
}
public function setId($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->id !== $v) {
$this->id = $v;
$this->modifiedColumns[] = QualificationsPeer::ID;
}
}
public function setUserId($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->user_id !== $v) {
$this->user_id = $v;
$this->modifiedColumns[] = QualificationsPeer::USER_ID;
}
if ($this->aUser !== null && $this->aUser->getId() !== $v) {
$this->aUser = null;
}
}
public function setDeviceId($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->device_id !== $v) {
$this->device_id = $v;
$this->modifiedColumns[] = QualificationsPeer::DEVICE_ID;
}
if ($this->aDevice !== null && $this->aDevice->getId() !== $v) {
$this->aDevice = null;
}
}
public function setCreatedAt($v)
{
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
}
} else {
$ts = $v;
}
if ($this->created_at !== $ts) {
$this->created_at = $ts;
$this->modifiedColumns[] = QualificationsPeer::CREATED_AT;
}
}
public function setUpdatedAt($v)
{
if ($v !== null && !is_int($v)) {
$ts = strtotime($v);
if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
}
} else {
$ts = $v;
}
if ($this->updated_at !== $ts) {
$this->updated_at = $ts;
$this->modifiedColumns[] = QualificationsPeer::UPDATED_AT;
}
}
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
$this->id = $rs->getInt($startcol + 0);
$this->user_id = $rs->getInt($startcol + 1);
$this->device_id = $rs->getInt($startcol + 2);
$this->created_at = $rs->getTimestamp($startcol + 3, null);
$this->updated_at = $rs->getTimestamp($startcol + 4, null);
$this->resetModified();
$this->setNew(false);
return $startcol + 5;
} catch (Exception $e) {
throw new PropelException("Error populating Qualifications object", $e);
}
}
public function delete($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(QualificationsPeer::DATABASE_NAME);
}
try {
$con->begin();
QualificationsPeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
public function save($con = null)
{
if ($this->isNew() && !$this->isColumnModified(QualificationsPeer::CREATED_AT))
{
$this->setCreatedAt(time());
}
if ($this->isModified() && !$this->isColumnModified(QualificationsPeer::UPDATED_AT))
{
$this->setUpdatedAt(time());
}
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(QualificationsPeer::DATABASE_NAME);
}
try {
$con->begin();
$affectedRows = $this->doSave($con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
protected function doSave($con)
{
$affectedRows = 0; if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->aUser !== null) {
if ($this->aUser->isModified()) {
$affectedRows += $this->aUser->save($con);
}
$this->setUser($this->aUser);
}
if ($this->aDevice !== null) {
if ($this->aDevice->isModified()) {
$affectedRows += $this->aDevice->save($con);
}
$this->setDevice($this->aDevice);
}
if ($this->isModified()) {
if ($this->isNew()) {
$pk = QualificationsPeer::doInsert($this, $con);
$affectedRows += 1;
$this->setId($pk);
$this->setNew(false);
} else {
$affectedRows += QualificationsPeer::doUpdate($this, $con);
}
$this->resetModified(); }
$this->alreadyInSave = false;
}
return $affectedRows;
}
protected $validationFailures = array();
public function getValidationFailures()
{
return $this->validationFailures;
}
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
}
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if ($this->aUser !== null) {
if (!$this->aUser->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aUser->getValidationFailures());
}
}
if ($this->aDevice !== null) {
if (!$this->aDevice->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aDevice->getValidationFailures());
}
}
if (($retval = QualificationsPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
}
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = QualificationsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->getByPosition($pos);
}
public function getByPosition($pos)
{
switch($pos) {
case 0:
return $this->getId();
break;
case 1:
return $this->getUserId();
break;
case 2:
return $this->getDeviceId();
break;
case 3:
return $this->getCreatedAt();
break;
case 4:
return $this->getUpdatedAt();
break;
default:
return null;
break;
} }
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$keys = QualificationsPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getUserId(),
$keys[2] => $this->getDeviceId(),
$keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
);
return $result;
}
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = QualificationsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
}
public function setByPosition($pos, $value)
{
switch($pos) {
case 0:
$this->setId($value);
break;
case 1:
$this->setUserId($value);
break;
case 2:
$this->setDeviceId($value);
break;
case 3:
$this->setCreatedAt($value);
break;
case 4:
$this->setUpdatedAt($value);
break;
} }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = QualificationsPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setUserId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDeviceId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
}
public function buildCriteria()
{
$criteria = new Criteria(QualificationsPeer::DATABASE_NAME);
if ($this->isColumnModified(QualificationsPeer::ID)) $criteria->add(QualificationsPeer::ID, $this->id);
if ($this->isColumnModified(QualificationsPeer::USER_ID)) $criteria->add(QualificationsPeer::USER_ID, $this->user_id);
if ($this->isColumnModified(QualificationsPeer::DEVICE_ID)) $criteria->add(QualificationsPeer::DEVICE_ID, $this->device_id);
if ($this->isColumnModified(QualificationsPeer::CREATED_AT)) $criteria->add(QualificationsPeer::CREATED_AT, $this->created_at);
if ($this->isColumnModified(QualificationsPeer::UPDATED_AT)) $criteria->add(QualificationsPeer::UPDATED_AT, $this->updated_at);
return $criteria;
}
public function buildPkeyCriteria()
{
$criteria = new Criteria(QualificationsPeer::DATABASE_NAME);
$criteria->add(QualificationsPeer::ID, $this->id);
return $criteria;
}
public function getPrimaryKey()
{
return $this->getId();
}
public function setPrimaryKey($key)
{
$this->setId($key);
}
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setUserId($this->user_id);
$copyObj->setDeviceId($this->device_id);
$copyObj->setCreatedAt($this->created_at);
$copyObj->setUpdatedAt($this->updated_at);
$copyObj->setNew(true);
$copyObj->setId(NULL);
}
public function copy($deepCopy = false)
{
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new QualificationsPeer();
}
return self::$peer;
}
public function setUser($v)
{
if ($v === null) {
$this->setUserId(NULL);
} else {
$this->setUserId($v->getId());
}
$this->aUser = $v;
}
public function getUser($con = null)
{
include_once 'lib/model/om/BaseUserPeer.php';
if ($this->aUser === null && ($this->user_id !== null)) {
$this->aUser = UserPeer::retrieveByPK($this->user_id, $con);
}
return $this->aUser;
}
public function setDevice($v)
{
if ($v === null) {
$this->setDeviceId(NULL);
} else {
$this->setDeviceId($v->getId());
}
$this->aDevice = $v;
}
public function getDevice($con = null)
{
include_once 'lib/model/om/BaseDevicePeer.php';
if ($this->aDevice === null && ($this->device_id !== null)) {
$this->aDevice = DevicePeer::retrieveByPK($this->device_id, $con);
}
return $this->aDevice;
}
}