applyDefaultValues(); } public function applyDefaultValues() { } public function getFileId() { return $this->file_id; } public function getFileResource() { return $this->file_resource; } public function getFileCategory() { return $this->file_category; } public function getFileUser() { return $this->file_user; } public function getFileName() { return $this->file_name; } public function getFileType() { return $this->file_type; } public function getFileDate($format = 'Y-m-d H:i:s') { if ($this->file_date === null) { return null; } if ($this->file_date === '0000-00-00 00:00:00') { return null; } else { try { $dt = new DateTime($this->file_date); } catch (Exception $x) { throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->file_date, true), $x); } } if ($format === null) { return $dt; } elseif (strpos($format, '%') !== false) { return strftime($format, $dt->format('U')); } else { return $dt->format($format); } } public function setFileId($v) { if ($v !== null) { $v = (int) $v; } if ($this->file_id !== $v) { $this->file_id = $v; $this->modifiedColumns[] = TblspacefilePeer::FILE_ID; } return $this; } public function setFileResource($v) { if ($v !== null) { $v = (int) $v; } if ($this->file_resource !== $v) { $this->file_resource = $v; $this->modifiedColumns[] = TblspacefilePeer::FILE_RESOURCE; } if ($this->aTblspaceresource !== null && $this->aTblspaceresource->getResId() !== $v) { $this->aTblspaceresource = null; } return $this; } public function setFileCategory($v) { if ($v !== null) { $v = (int) $v; } if ($this->file_category !== $v) { $this->file_category = $v; $this->modifiedColumns[] = TblspacefilePeer::FILE_CATEGORY; } return $this; } public function setFileUser($v) { if ($v !== null) { $v = (int) $v; } if ($this->file_user !== $v) { $this->file_user = $v; $this->modifiedColumns[] = TblspacefilePeer::FILE_USER; } return $this; } public function setFileName($v) { if ($v !== null) { $v = (string) $v; } if ($this->file_name !== $v) { $this->file_name = $v; $this->modifiedColumns[] = TblspacefilePeer::FILE_NAME; } return $this; } public function setFileType($v) { if ($v !== null) { $v = (string) $v; } if ($this->file_type !== $v) { $this->file_type = $v; $this->modifiedColumns[] = TblspacefilePeer::FILE_TYPE; } return $this; } public function setFileDate($v) { if ($v === null || $v === '') { $dt = null; } elseif ($v instanceof DateTime) { $dt = $v; } else { try { if (is_numeric($v)) { $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); } else { $dt = new DateTime($v); } } catch (Exception $x) { throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); } } if ( $this->file_date !== null || $dt !== null ) { $currNorm = ($this->file_date !== null && $tmpDt = new DateTime($this->file_date)) ? $tmpDt->format('Y-m-d H:i:s') : null; $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null; if ( ($currNorm !== $newNorm) ) { $this->file_date = ($dt ? $dt->format('Y-m-d H:i:s') : null); $this->modifiedColumns[] = TblspacefilePeer::FILE_DATE; } } return $this; } public function hasOnlyDefaultValues() { if (array_diff($this->modifiedColumns, array())) { return false; } return true; } public function hydrate($row, $startcol = 0, $rehydrate = false) { try { $this->file_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->file_resource = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->file_category = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; $this->file_user = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; $this->file_name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->file_type = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->file_date = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } return $startcol + 7; } catch (Exception $e) { throw new PropelException("Error populating Tblspacefile object", $e); } } public function ensureConsistency() { if ($this->aTblspaceresource !== null && $this->file_resource !== $this->aTblspaceresource->getResId()) { $this->aTblspaceresource = null; } } public function reload($deep = false, PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("Cannot reload a deleted object."); } if ($this->isNew()) { throw new PropelException("Cannot reload an unsaved object."); } if ($con === null) { $con = Propel::getConnection(TblspacefilePeer::DATABASE_NAME, Propel::CONNECTION_READ); } $stmt = TblspacefilePeer::doSelectStmt($this->buildPkeyCriteria(), $con); $row = $stmt->fetch(PDO::FETCH_NUM); $stmt->closeCursor(); if (!$row) { throw new PropelException('Cannot find matching row in the database to reload object values.'); } $this->hydrate($row, 0, true); if ($deep) { $this->aTblspaceresource = null; } } public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(TblspacefilePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { TblspacefilePeer::doDelete($this, $con); $this->setDeleted(true); $con->commit(); } catch (PropelException $e) { $con->rollBack(); throw $e; } } public function save(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("You cannot save an object that has been deleted."); } if ($con === null) { $con = Propel::getConnection(TblspacefilePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $affectedRows = $this->doSave($con); $con->commit(); TblspacefilePeer::addInstanceToPool($this); return $affectedRows; } catch (PropelException $e) { $con->rollBack(); throw $e; } } protected function doSave(PropelPDO $con) { $affectedRows = 0; if (!$this->alreadyInSave) { $this->alreadyInSave = true; if ($this->aTblspaceresource !== null) { if ($this->aTblspaceresource->isModified() || $this->aTblspaceresource->isNew()) { $affectedRows += $this->aTblspaceresource->save($con); } $this->setTblspaceresource($this->aTblspaceresource); } if ($this->isNew() ) { $this->modifiedColumns[] = TblspacefilePeer::FILE_ID; } if ($this->isModified()) { if ($this->isNew()) { $pk = TblspacefilePeer::doInsert($this, $con); $affectedRows += 1; $this->setFileId($pk); $this->setNew(false); } else { $affectedRows += TblspacefilePeer::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->aTblspaceresource !== null) { if (!$this->aTblspaceresource->validate($columns)) { $failureMap = array_merge($failureMap, $this->aTblspaceresource->getValidationFailures()); } } if (($retval = TblspacefilePeer::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 = TblspacefilePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); $field = $this->getByPosition($pos); return $field; } public function getByPosition($pos) { switch($pos) { case 0: return $this->getFileId(); break; case 1: return $this->getFileResource(); break; case 2: return $this->getFileCategory(); break; case 3: return $this->getFileUser(); break; case 4: return $this->getFileName(); break; case 5: return $this->getFileType(); break; case 6: return $this->getFileDate(); break; default: return null; break; } } public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) { $keys = TblspacefilePeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getFileId(), $keys[1] => $this->getFileResource(), $keys[2] => $this->getFileCategory(), $keys[3] => $this->getFileUser(), $keys[4] => $this->getFileName(), $keys[5] => $this->getFileType(), $keys[6] => $this->getFileDate(), ); return $result; } public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TblspacefilePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } public function setByPosition($pos, $value) { switch($pos) { case 0: $this->setFileId($value); break; case 1: $this->setFileResource($value); break; case 2: $this->setFileCategory($value); break; case 3: $this->setFileUser($value); break; case 4: $this->setFileName($value); break; case 5: $this->setFileType($value); break; case 6: $this->setFileDate($value); break; } } public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TblspacefilePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setFileId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setFileResource($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setFileCategory($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setFileUser($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setFileName($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setFileType($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setFileDate($arr[$keys[6]]); } public function buildCriteria() { $criteria = new Criteria(TblspacefilePeer::DATABASE_NAME); if ($this->isColumnModified(TblspacefilePeer::FILE_ID)) $criteria->add(TblspacefilePeer::FILE_ID, $this->file_id); if ($this->isColumnModified(TblspacefilePeer::FILE_RESOURCE)) $criteria->add(TblspacefilePeer::FILE_RESOURCE, $this->file_resource); if ($this->isColumnModified(TblspacefilePeer::FILE_CATEGORY)) $criteria->add(TblspacefilePeer::FILE_CATEGORY, $this->file_category); if ($this->isColumnModified(TblspacefilePeer::FILE_USER)) $criteria->add(TblspacefilePeer::FILE_USER, $this->file_user); if ($this->isColumnModified(TblspacefilePeer::FILE_NAME)) $criteria->add(TblspacefilePeer::FILE_NAME, $this->file_name); if ($this->isColumnModified(TblspacefilePeer::FILE_TYPE)) $criteria->add(TblspacefilePeer::FILE_TYPE, $this->file_type); if ($this->isColumnModified(TblspacefilePeer::FILE_DATE)) $criteria->add(TblspacefilePeer::FILE_DATE, $this->file_date); return $criteria; } public function buildPkeyCriteria() { $criteria = new Criteria(TblspacefilePeer::DATABASE_NAME); $criteria->add(TblspacefilePeer::FILE_ID, $this->file_id); return $criteria; } public function getPrimaryKey() { return $this->getFileId(); } public function setPrimaryKey($key) { $this->setFileId($key); } public function copyInto($copyObj, $deepCopy = false) { $copyObj->setFileResource($this->file_resource); $copyObj->setFileCategory($this->file_category); $copyObj->setFileUser($this->file_user); $copyObj->setFileName($this->file_name); $copyObj->setFileType($this->file_type); $copyObj->setFileDate($this->file_date); $copyObj->setNew(true); $copyObj->setFileId(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 TblspacefilePeer(); } return self::$peer; } public function setTblspaceresource(Tblspaceresource $v = null) { if ($v === null) { $this->setFileResource(NULL); } else { $this->setFileResource($v->getResId()); } $this->aTblspaceresource = $v; if ($v !== null) { $v->addTblspacefile($this); } return $this; } public function getTblspaceresource(PropelPDO $con = null) { if ($this->aTblspaceresource === null && ($this->file_resource !== null)) { $this->aTblspaceresource = TblspaceresourcePeer::retrieveByPK($this->file_resource, $con); } return $this->aTblspaceresource; } public function clearAllReferences($deep = false) { if ($deep) { } $this->aTblspaceresource = null; } }