applyDefaultValues(); } public function applyDefaultValues() { } public function getResId() { return $this->res_id; } public function getResFilename() { return $this->res_filename; } public function getResFilesize() { return $this->res_filesize; } public function getResFilecrc() { return $this->res_filecrc; } public function setResId($v) { if ($v !== null) { $v = (int) $v; } if ($this->res_id !== $v) { $this->res_id = $v; $this->modifiedColumns[] = TblspaceresourcePeer::RES_ID; } return $this; } public function setResFilename($v) { if ($v !== null) { $v = (string) $v; } if ($this->res_filename !== $v) { $this->res_filename = $v; $this->modifiedColumns[] = TblspaceresourcePeer::RES_FILENAME; } return $this; } public function setResFilesize($v) { if ($v !== null) { $v = (int) $v; } if ($this->res_filesize !== $v) { $this->res_filesize = $v; $this->modifiedColumns[] = TblspaceresourcePeer::RES_FILESIZE; } return $this; } public function setResFilecrc($v) { if ($v !== null) { $v = (int) $v; } if ($this->res_filecrc !== $v) { $this->res_filecrc = $v; $this->modifiedColumns[] = TblspaceresourcePeer::RES_FILECRC; } 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->res_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->res_filename = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; $this->res_filesize = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null; $this->res_filecrc = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null; $this->resetModified(); $this->setNew(false); if ($rehydrate) { $this->ensureConsistency(); } return $startcol + 4; } catch (Exception $e) { throw new PropelException("Error populating Tblspaceresource object", $e); } } public function ensureConsistency() { } 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(TblspaceresourcePeer::DATABASE_NAME, Propel::CONNECTION_READ); } $stmt = TblspaceresourcePeer::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->collTblspacefiles = null; $this->lastTblspacefileCriteria = 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(TblspaceresourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { TblspaceresourcePeer::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(TblspaceresourcePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $affectedRows = $this->doSave($con); $con->commit(); TblspaceresourcePeer::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->isNew() ) { $this->modifiedColumns[] = TblspaceresourcePeer::RES_ID; } if ($this->isModified()) { if ($this->isNew()) { $pk = TblspaceresourcePeer::doInsert($this, $con); $affectedRows += 1; $this->setResId($pk); $this->setNew(false); } else { $affectedRows += TblspaceresourcePeer::doUpdate($this, $con); } $this->resetModified(); } if ($this->collTblspacefiles !== null) { foreach ($this->collTblspacefiles 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 = TblspaceresourcePeer::doValidate($this, $columns)) !== true) { $failureMap = array_merge($failureMap, $retval); } if ($this->collTblspacefiles !== null) { foreach ($this->collTblspacefiles 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 = TblspaceresourcePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); $field = $this->getByPosition($pos); return $field; } public function getByPosition($pos) { switch($pos) { case 0: return $this->getResId(); break; case 1: return $this->getResFilename(); break; case 2: return $this->getResFilesize(); break; case 3: return $this->getResFilecrc(); break; default: return null; break; } } public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) { $keys = TblspaceresourcePeer::getFieldNames($keyType); $result = array( $keys[0] => $this->getResId(), $keys[1] => $this->getResFilename(), $keys[2] => $this->getResFilesize(), $keys[3] => $this->getResFilecrc(), ); return $result; } public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) { $pos = TblspaceresourcePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); return $this->setByPosition($pos, $value); } public function setByPosition($pos, $value) { switch($pos) { case 0: $this->setResId($value); break; case 1: $this->setResFilename($value); break; case 2: $this->setResFilesize($value); break; case 3: $this->setResFilecrc($value); break; } } public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = TblspaceresourcePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) $this->setResId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setResFilename($arr[$keys[1]]); if (array_key_exists($keys[2], $arr)) $this->setResFilesize($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setResFilecrc($arr[$keys[3]]); } public function buildCriteria() { $criteria = new Criteria(TblspaceresourcePeer::DATABASE_NAME); if ($this->isColumnModified(TblspaceresourcePeer::RES_ID)) $criteria->add(TblspaceresourcePeer::RES_ID, $this->res_id); if ($this->isColumnModified(TblspaceresourcePeer::RES_FILENAME)) $criteria->add(TblspaceresourcePeer::RES_FILENAME, $this->res_filename); if ($this->isColumnModified(TblspaceresourcePeer::RES_FILESIZE)) $criteria->add(TblspaceresourcePeer::RES_FILESIZE, $this->res_filesize); if ($this->isColumnModified(TblspaceresourcePeer::RES_FILECRC)) $criteria->add(TblspaceresourcePeer::RES_FILECRC, $this->res_filecrc); return $criteria; } public function buildPkeyCriteria() { $criteria = new Criteria(TblspaceresourcePeer::DATABASE_NAME); $criteria->add(TblspaceresourcePeer::RES_ID, $this->res_id); return $criteria; } public function getPrimaryKey() { return $this->getResId(); } public function setPrimaryKey($key) { $this->setResId($key); } public function copyInto($copyObj, $deepCopy = false) { $copyObj->setResFilename($this->res_filename); $copyObj->setResFilesize($this->res_filesize); $copyObj->setResFilecrc($this->res_filecrc); if ($deepCopy) { $copyObj->setNew(false); foreach ($this->getTblspacefiles() as $relObj) { if ($relObj !== $this) { $copyObj->addTblspacefile($relObj->copy($deepCopy)); } } } $copyObj->setNew(true); $copyObj->setResId(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 TblspaceresourcePeer(); } return self::$peer; } public function clearTblspacefiles() { $this->collTblspacefiles = null; } public function initTblspacefiles() { $this->collTblspacefiles = array(); } public function getTblspacefiles($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(TblspaceresourcePeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collTblspacefiles === null) { if ($this->isNew()) { $this->collTblspacefiles = array(); } else { $criteria->add(TblspacefilePeer::FILE_RESOURCE, $this->res_id); TblspacefilePeer::addSelectColumns($criteria); $this->collTblspacefiles = TblspacefilePeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(TblspacefilePeer::FILE_RESOURCE, $this->res_id); TblspacefilePeer::addSelectColumns($criteria); if (!isset($this->lastTblspacefileCriteria) || !$this->lastTblspacefileCriteria->equals($criteria)) { $this->collTblspacefiles = TblspacefilePeer::doSelect($criteria, $con); } } } $this->lastTblspacefileCriteria = $criteria; return $this->collTblspacefiles; } public function countTblspacefiles(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(TblspaceresourcePeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collTblspacefiles === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(TblspacefilePeer::FILE_RESOURCE, $this->res_id); $count = TblspacefilePeer::doCount($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(TblspacefilePeer::FILE_RESOURCE, $this->res_id); if (!isset($this->lastTblspacefileCriteria) || !$this->lastTblspacefileCriteria->equals($criteria)) { $count = TblspacefilePeer::doCount($criteria, $con); } else { $count = count($this->collTblspacefiles); } } else { $count = count($this->collTblspacefiles); } } $this->lastTblspacefileCriteria = $criteria; return $count; } public function addTblspacefile(Tblspacefile $l) { if ($this->collTblspacefiles === null) { $this->initTblspacefiles(); } if (!in_array($l, $this->collTblspacefiles, true)) { array_push($this->collTblspacefiles, $l); $l->setTblspaceresource($this); } } public function clearAllReferences($deep = false) { if ($deep) { if ($this->collTblspacefiles) { foreach ((array) $this->collTblspacefiles as $o) { $o->clearAllReferences($deep); } } } $this->collTblspacefiles = null; } }