Files
pae.co.at/trunk/proactiveenglish/lib/model/om/BaseEmployee.php
2017-03-02 21:57:21 -06:00

875 lines
17 KiB
PHP

<?php
abstract class BaseEmployee extends BaseObject implements Persistent {
protected static $peer;
protected $id;
protected $name;
protected $degrees;
protected $phone;
protected $cellphone;
protected $email;
protected $picture;
protected $active;
protected $position;
protected $slug;
protected $sort_order;
protected $aLuEmployeePosition;
protected $collEmployeeI18ns;
protected $lastEmployeeI18nCriteria = null;
protected $alreadyInSave = false;
protected $alreadyInValidation = false;
protected $culture;
public function getId()
{
return $this->id;
}
public function getName()
{
return $this->name;
}
public function getDegrees()
{
return $this->degrees;
}
public function getPhone()
{
return $this->phone;
}
public function getCellphone()
{
return $this->cellphone;
}
public function getEmail()
{
return $this->email;
}
public function getPicture()
{
return $this->picture;
}
public function getActive()
{
return $this->active;
}
public function getPosition()
{
return $this->position;
}
public function getSlug()
{
return $this->slug;
}
public function getSortOrder()
{
return $this->sort_order;
}
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[] = EmployeePeer::ID;
}
}
public function setName($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->name !== $v) {
$this->name = $v;
$this->modifiedColumns[] = EmployeePeer::NAME;
}
}
public function setDegrees($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->degrees !== $v) {
$this->degrees = $v;
$this->modifiedColumns[] = EmployeePeer::DEGREES;
}
}
public function setPhone($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->phone !== $v) {
$this->phone = $v;
$this->modifiedColumns[] = EmployeePeer::PHONE;
}
}
public function setCellphone($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->cellphone !== $v) {
$this->cellphone = $v;
$this->modifiedColumns[] = EmployeePeer::CELLPHONE;
}
}
public function setEmail($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->email !== $v) {
$this->email = $v;
$this->modifiedColumns[] = EmployeePeer::EMAIL;
}
}
public function setPicture($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->picture !== $v) {
$this->picture = $v;
$this->modifiedColumns[] = EmployeePeer::PICTURE;
}
}
public function setActive($v)
{
if ($this->active !== $v) {
$this->active = $v;
$this->modifiedColumns[] = EmployeePeer::ACTIVE;
}
}
public function setPosition($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->position !== $v) {
$this->position = $v;
$this->modifiedColumns[] = EmployeePeer::POSITION;
}
if ($this->aLuEmployeePosition !== null && $this->aLuEmployeePosition->getId() !== $v) {
$this->aLuEmployeePosition = null;
}
}
public function setSlug($v)
{
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->slug !== $v) {
$this->slug = $v;
$this->modifiedColumns[] = EmployeePeer::SLUG;
}
}
public function setSortOrder($v)
{
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->sort_order !== $v) {
$this->sort_order = $v;
$this->modifiedColumns[] = EmployeePeer::SORT_ORDER;
}
}
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
$this->id = $rs->getInt($startcol + 0);
$this->name = $rs->getString($startcol + 1);
$this->degrees = $rs->getString($startcol + 2);
$this->phone = $rs->getString($startcol + 3);
$this->cellphone = $rs->getString($startcol + 4);
$this->email = $rs->getString($startcol + 5);
$this->picture = $rs->getString($startcol + 6);
$this->active = $rs->getBoolean($startcol + 7);
$this->position = $rs->getInt($startcol + 8);
$this->slug = $rs->getString($startcol + 9);
$this->sort_order = $rs->getInt($startcol + 10);
$this->resetModified();
$this->setNew(false);
return $startcol + 11;
} catch (Exception $e) {
throw new PropelException("Error populating Employee 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(EmployeePeer::DATABASE_NAME);
}
try {
$con->begin();
EmployeePeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
public function save($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(EmployeePeer::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->aLuEmployeePosition !== null) {
if ($this->aLuEmployeePosition->isModified()) {
$affectedRows += $this->aLuEmployeePosition->save($con);
}
$this->setLuEmployeePosition($this->aLuEmployeePosition);
}
if ($this->isModified()) {
if ($this->isNew()) {
$pk = EmployeePeer::doInsert($this, $con);
$affectedRows += 1;
$this->setId($pk);
$this->setNew(false);
} else {
$affectedRows += EmployeePeer::doUpdate($this, $con);
}
$this->resetModified(); }
if ($this->collEmployeeI18ns !== null) {
foreach($this->collEmployeeI18ns as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$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->aLuEmployeePosition !== null) {
if (!$this->aLuEmployeePosition->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aLuEmployeePosition->getValidationFailures());
}
}
if (($retval = EmployeePeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
if ($this->collEmployeeI18ns !== null) {
foreach($this->collEmployeeI18ns as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
}
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = EmployeePeer::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->getName();
break;
case 2:
return $this->getDegrees();
break;
case 3:
return $this->getPhone();
break;
case 4:
return $this->getCellphone();
break;
case 5:
return $this->getEmail();
break;
case 6:
return $this->getPicture();
break;
case 7:
return $this->getActive();
break;
case 8:
return $this->getPosition();
break;
case 9:
return $this->getSlug();
break;
case 10:
return $this->getSortOrder();
break;
default:
return null;
break;
} }
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$keys = EmployeePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getId(),
$keys[1] => $this->getName(),
$keys[2] => $this->getDegrees(),
$keys[3] => $this->getPhone(),
$keys[4] => $this->getCellphone(),
$keys[5] => $this->getEmail(),
$keys[6] => $this->getPicture(),
$keys[7] => $this->getActive(),
$keys[8] => $this->getPosition(),
$keys[9] => $this->getSlug(),
$keys[10] => $this->getSortOrder(),
);
return $result;
}
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = EmployeePeer::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->setName($value);
break;
case 2:
$this->setDegrees($value);
break;
case 3:
$this->setPhone($value);
break;
case 4:
$this->setCellphone($value);
break;
case 5:
$this->setEmail($value);
break;
case 6:
$this->setPicture($value);
break;
case 7:
$this->setActive($value);
break;
case 8:
$this->setPosition($value);
break;
case 9:
$this->setSlug($value);
break;
case 10:
$this->setSortOrder($value);
break;
} }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = EmployeePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDegrees($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setPhone($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setCellphone($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setEmail($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setPicture($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setActive($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setPosition($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setSlug($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setSortOrder($arr[$keys[10]]);
}
public function buildCriteria()
{
$criteria = new Criteria(EmployeePeer::DATABASE_NAME);
if ($this->isColumnModified(EmployeePeer::ID)) $criteria->add(EmployeePeer::ID, $this->id);
if ($this->isColumnModified(EmployeePeer::NAME)) $criteria->add(EmployeePeer::NAME, $this->name);
if ($this->isColumnModified(EmployeePeer::DEGREES)) $criteria->add(EmployeePeer::DEGREES, $this->degrees);
if ($this->isColumnModified(EmployeePeer::PHONE)) $criteria->add(EmployeePeer::PHONE, $this->phone);
if ($this->isColumnModified(EmployeePeer::CELLPHONE)) $criteria->add(EmployeePeer::CELLPHONE, $this->cellphone);
if ($this->isColumnModified(EmployeePeer::EMAIL)) $criteria->add(EmployeePeer::EMAIL, $this->email);
if ($this->isColumnModified(EmployeePeer::PICTURE)) $criteria->add(EmployeePeer::PICTURE, $this->picture);
if ($this->isColumnModified(EmployeePeer::ACTIVE)) $criteria->add(EmployeePeer::ACTIVE, $this->active);
if ($this->isColumnModified(EmployeePeer::POSITION)) $criteria->add(EmployeePeer::POSITION, $this->position);
if ($this->isColumnModified(EmployeePeer::SLUG)) $criteria->add(EmployeePeer::SLUG, $this->slug);
if ($this->isColumnModified(EmployeePeer::SORT_ORDER)) $criteria->add(EmployeePeer::SORT_ORDER, $this->sort_order);
return $criteria;
}
public function buildPkeyCriteria()
{
$criteria = new Criteria(EmployeePeer::DATABASE_NAME);
$criteria->add(EmployeePeer::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->setName($this->name);
$copyObj->setDegrees($this->degrees);
$copyObj->setPhone($this->phone);
$copyObj->setCellphone($this->cellphone);
$copyObj->setEmail($this->email);
$copyObj->setPicture($this->picture);
$copyObj->setActive($this->active);
$copyObj->setPosition($this->position);
$copyObj->setSlug($this->slug);
$copyObj->setSortOrder($this->sort_order);
if ($deepCopy) {
$copyObj->setNew(false);
foreach($this->getEmployeeI18ns() as $relObj) {
$copyObj->addEmployeeI18n($relObj->copy($deepCopy));
}
}
$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 EmployeePeer();
}
return self::$peer;
}
public function setLuEmployeePosition($v)
{
if ($v === null) {
$this->setPosition(NULL);
} else {
$this->setPosition($v->getId());
}
$this->aLuEmployeePosition = $v;
}
public function getLuEmployeePosition($con = null)
{
if ($this->aLuEmployeePosition === null && ($this->position !== null)) {
include_once 'lib/model/om/BaseLuEmployeePositionPeer.php';
$this->aLuEmployeePosition = LuEmployeePositionPeer::retrieveByPK($this->position, $con);
}
return $this->aLuEmployeePosition;
}
public function initEmployeeI18ns()
{
if ($this->collEmployeeI18ns === null) {
$this->collEmployeeI18ns = array();
}
}
public function getEmployeeI18ns($criteria = null, $con = null)
{
include_once 'lib/model/om/BaseEmployeeI18nPeer.php';
if ($criteria === null) {
$criteria = new Criteria();
}
elseif ($criteria instanceof Criteria)
{
$criteria = clone $criteria;
}
if ($this->collEmployeeI18ns === null) {
if ($this->isNew()) {
$this->collEmployeeI18ns = array();
} else {
$criteria->add(EmployeeI18nPeer::ID, $this->getId());
EmployeeI18nPeer::addSelectColumns($criteria);
$this->collEmployeeI18ns = EmployeeI18nPeer::doSelect($criteria, $con);
}
} else {
if (!$this->isNew()) {
$criteria->add(EmployeeI18nPeer::ID, $this->getId());
EmployeeI18nPeer::addSelectColumns($criteria);
if (!isset($this->lastEmployeeI18nCriteria) || !$this->lastEmployeeI18nCriteria->equals($criteria)) {
$this->collEmployeeI18ns = EmployeeI18nPeer::doSelect($criteria, $con);
}
}
}
$this->lastEmployeeI18nCriteria = $criteria;
return $this->collEmployeeI18ns;
}
public function countEmployeeI18ns($criteria = null, $distinct = false, $con = null)
{
include_once 'lib/model/om/BaseEmployeeI18nPeer.php';
if ($criteria === null) {
$criteria = new Criteria();
}
elseif ($criteria instanceof Criteria)
{
$criteria = clone $criteria;
}
$criteria->add(EmployeeI18nPeer::ID, $this->getId());
return EmployeeI18nPeer::doCount($criteria, $distinct, $con);
}
public function addEmployeeI18n(EmployeeI18n $l)
{
$this->collEmployeeI18ns[] = $l;
$l->setEmployee($this);
}
public function getCulture()
{
return $this->culture;
}
public function setCulture($culture)
{
$this->culture = $culture;
}
public function getBiography()
{
$obj = $this->getCurrentEmployeeI18n();
return ($obj ? $obj->getBiography() : null);
}
public function setBiography($value)
{
$this->getCurrentEmployeeI18n()->setBiography($value);
}
public function getTitle()
{
$obj = $this->getCurrentEmployeeI18n();
return ($obj ? $obj->getTitle() : null);
}
public function setTitle($value)
{
$this->getCurrentEmployeeI18n()->setTitle($value);
}
protected $current_i18n = array();
public function getCurrentEmployeeI18n()
{
if (!isset($this->current_i18n[$this->culture]))
{
$obj = EmployeeI18nPeer::retrieveByPK($this->getId(), $this->culture);
if ($obj)
{
$this->setEmployeeI18nForCulture($obj, $this->culture);
}
else
{
$this->setEmployeeI18nForCulture(new EmployeeI18n(), $this->culture);
$this->current_i18n[$this->culture]->setCulture($this->culture);
}
}
return $this->current_i18n[$this->culture];
}
public function setEmployeeI18nForCulture($object, $culture)
{
$this->current_i18n[$culture] = $object;
$this->addEmployeeI18n($object);
}
}