id; } public function getPicture() { return $this->picture; } public function getExpiresOn($format = 'Y-m-d H:i:s') { if ($this->expires_on === null || $this->expires_on === '') { return null; } elseif (!is_int($this->expires_on)) { $ts = strtotime($this->expires_on); if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [expires_on] as date/time value: " . var_export($this->expires_on, true)); } } else { $ts = $this->expires_on; } 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[] = EventPeer::ID; } } public function setPicture($v) { if ($v !== null && !is_string($v)) { $v = (string) $v; } if ($this->picture !== $v) { $this->picture = $v; $this->modifiedColumns[] = EventPeer::PICTURE; } } public function setExpiresOn($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 [expires_on] from input: " . var_export($v, true)); } } else { $ts = $v; } if ($this->expires_on !== $ts) { $this->expires_on = $ts; $this->modifiedColumns[] = EventPeer::EXPIRES_ON; } } public function hydrate(ResultSet $rs, $startcol = 1) { try { $this->id = $rs->getInt($startcol + 0); $this->picture = $rs->getString($startcol + 1); $this->expires_on = $rs->getTimestamp($startcol + 2, null); $this->resetModified(); $this->setNew(false); return $startcol + 3; } catch (Exception $e) { throw new PropelException("Error populating Event 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(EventPeer::DATABASE_NAME); } try { $con->begin(); EventPeer::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(EventPeer::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->isModified()) { if ($this->isNew()) { $pk = EventPeer::doInsert($this, $con); $affectedRows += 1; $this->setId($pk); $this->setNew(false); } else { $affectedRows += EventPeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collEventI18ns !== null) { foreach($this->collEventI18ns 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 (($retval = EventPeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); } if ($this->collEventI18ns !== null) { foreach($this->collEventI18ns 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 = EventPeer::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->getPicture(); break; case 2: return $this->getExpiresOn(); break; default: return null; break; } } public function toArray($keyType = BasePeer::TYPE_PHPNAME) { $keys = EventPeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getPicture(), $keys[2] => $this->getExpiresOn(), ); return $result; } public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = EventPeer::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->setPicture($value); break; case 2: $this->setExpiresOn($value); break; } } public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EventPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setPicture($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setExpiresOn($arr[$keys[2]]); } public function buildCriteria() { $criteria = new Criteria(EventPeer::DATABASE_NAME); if ($this->isColumnModified(EventPeer::ID)) $criteria->add(EventPeer::ID, $this->id); if ($this->isColumnModified(EventPeer::PICTURE)) $criteria->add(EventPeer::PICTURE, $this->picture); if ($this->isColumnModified(EventPeer::EXPIRES_ON)) $criteria->add(EventPeer::EXPIRES_ON, $this->expires_on); return $criteria; } public function buildPkeyCriteria() { $criteria = new Criteria(EventPeer::DATABASE_NAME); $criteria->add(EventPeer::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->setPicture($this->picture); $copyObj->setExpiresOn($this->expires_on); if ($deepCopy) { $copyObj->setNew(false); foreach($this->getEventI18ns() as $relObj) { $copyObj->addEventI18n($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 EventPeer(); } return self::$peer; } public function initEventI18ns() { if ($this->collEventI18ns === null) { $this->collEventI18ns = array(); } } public function getEventI18ns($criteria = null, $con = null) { include_once 'lib/model/om/BaseEventI18nPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEventI18ns === null) { if ($this->isNew()) { $this->collEventI18ns = array(); } else { $criteria->add(EventI18nPeer::ID, $this->getId()); EventI18nPeer::addSelectColumns($criteria); $this->collEventI18ns = EventI18nPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(EventI18nPeer::ID, $this->getId()); EventI18nPeer::addSelectColumns($criteria); if (!isset($this->lastEventI18nCriteria) || !$this->lastEventI18nCriteria->equals($criteria)) { $this->collEventI18ns = EventI18nPeer::doSelect($criteria, $con); } } } $this->lastEventI18nCriteria = $criteria; return $this->collEventI18ns; } public function countEventI18ns($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseEventI18nPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(EventI18nPeer::ID, $this->getId()); return EventI18nPeer::doCount($criteria, $distinct, $con); } public function addEventI18n(EventI18n $l) { $this->collEventI18ns[] = $l; $l->setEvent($this); } public function getCulture() { return $this->culture; } public function setCulture($culture) { $this->culture = $culture; } public function getTitle() { $obj = $this->getCurrentEventI18n(); return ($obj ? $obj->getTitle() : null); } public function setTitle($value) { $this->getCurrentEventI18n()->setTitle($value); } public function getDescription() { $obj = $this->getCurrentEventI18n(); return ($obj ? $obj->getDescription() : null); } public function setDescription($value) { $this->getCurrentEventI18n()->setDescription($value); } protected $current_i18n = array(); public function getCurrentEventI18n() { if (!isset($this->current_i18n[$this->culture])) { $obj = EventI18nPeer::retrieveByPK($this->getId(), $this->culture); if ($obj) { $this->setEventI18nForCulture($obj, $this->culture); } else { $this->setEventI18nForCulture(new EventI18n(), $this->culture); $this->current_i18n[$this->culture]->setCulture($this->culture); } } return $this->current_i18n[$this->culture]; } public function setEventI18nForCulture($object, $culture) { $this->current_i18n[$culture] = $object; $this->addEventI18n($object); } }