--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a row from one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class Horbuch extends Medium {
+
+ /**
+ * Constructs a new Horbuch class, setting the class_key column to MediumPeer::CLASSKEY_2.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setClassKey(MediumPeer::CLASSKEY_2);
+ }
+
+} // Horbuch
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a query for one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class HorbuchQuery extends BaseHorbuchQuery {
+
+} // HorbuchQuery
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a row from one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class Krimi extends Medium {
+
+ /**
+ * Constructs a new Krimi class, setting the class_key column to MediumPeer::CLASSKEY_1.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setClassKey(MediumPeer::CLASSKEY_1);
+ }
+
+} // Krimi
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a query for one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class KrimiQuery extends BaseKrimiQuery {
+
+} // KrimiQuery
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a row from the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class Medium extends BaseMedium
+{
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isNew() || $this->mod >= 999999) {
+ $this->setMod(0);
+ } else {
+ $this->setMod($this->mod + 1);
+ }
+ return parent::save($con);
+ }
+
+}
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for performing query and update operations on the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class MediumPeer extends BaseMediumPeer
+{
+}
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for performing query and update operations on the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class MediumQuery extends BaseMediumQuery
+{
+}
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a row from one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class Roman extends Medium {
+
+ /**
+ * Constructs a new Roman class, setting the class_key column to MediumPeer::CLASSKEY_3.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setClassKey(MediumPeer::CLASSKEY_3);
+ }
+
+} // Roman
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a query for one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class RomanQuery extends BaseRomanQuery {
+
+} // RomanQuery
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for representing a row from the 'werkzeug' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class Werkzeug extends BaseWerkzeug
+{
+ public function save(PropelPDO $con = null)
+ {
+ if ($this->isNew() || $this->mod >= 999999) {
+ $this->setMod(0);
+ } else {
+ $this->setMod($this->mod + 1);
+ }
+ return parent::save($con);
+ }
+
+}
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for performing query and update operations on the 'werkzeug' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class WerkzeugPeer extends BaseWerkzeugPeer
+{
+}
--- /dev/null
+<?php
+
+
+
+/**
+ * Skeleton subclass for performing query and update operations on the 'werkzeug' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel
+ */
+class WerkzeugQuery extends BaseWerkzeugQuery
+{
+}
--- /dev/null
+<?php
+
+
+
+/**
+ * This class defines the structure of the 'medium' table.
+ *
+ *
+ *
+ * This map class is used by Propel to do runtime db structure discovery.
+ * For example, the createSelectSql() method checks the type of a given column used in an
+ * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
+ * (i.e. if it's a text column type).
+ *
+ * @package propel.generator.propel.map
+ */
+class MediumTableMap extends TableMap
+{
+
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'propel.map.MediumTableMap';
+
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('medium');
+ $this->setPhpName('Medium');
+ $this->setClassname('Medium');
+ $this->setPackage('propel');
+ $this->setUseIdGenerator(true);
+ $this->setSingleTableInheritance(true);
+ // columns
+ $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('mod', 'Mod', 'INTEGER', true, null, null);
+ $this->addColumn('autor', 'Autor', 'VARCHAR', true, 100, null);
+ $this->addColumn('titel', 'Titel', 'VARCHAR', true, 100, null);
+ $this->addColumn('eigentumer', 'Eigentumer', 'VARCHAR', true, 100, null);
+ $this->addColumn('zz_bei', 'ZzBei', 'VARCHAR', true, 100, null);
+ $this->addColumn('kommentar', 'Kommentar', 'VARCHAR', true, 100, null);
+ $this->addColumn('class_key', 'ClassKey', 'INTEGER', true, null, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
+
+} // MediumTableMap
--- /dev/null
+<?php
+
+
+
+/**
+ * This class defines the structure of the 'werkzeug' table.
+ *
+ *
+ *
+ * This map class is used by Propel to do runtime db structure discovery.
+ * For example, the createSelectSql() method checks the type of a given column used in an
+ * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
+ * (i.e. if it's a text column type).
+ *
+ * @package propel.generator.propel.map
+ */
+class WerkzeugTableMap extends TableMap
+{
+
+ /**
+ * The (dot-path) name of this class
+ */
+ const CLASS_NAME = 'propel.map.WerkzeugTableMap';
+
+ /**
+ * Initialize the table attributes, columns and validators
+ * Relations are not initialized by this method since they are lazy loaded
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function initialize()
+ {
+ // attributes
+ $this->setName('werkzeug');
+ $this->setPhpName('Werkzeug');
+ $this->setClassname('Werkzeug');
+ $this->setPackage('propel');
+ $this->setUseIdGenerator(true);
+ // columns
+ $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
+ $this->addColumn('mod', 'Mod', 'INTEGER', true, null, null);
+ $this->addColumn('typ', 'Typ', 'VARCHAR', true, 100, null);
+ $this->addColumn('beschreibung', 'Beschreibung', 'VARCHAR', true, 100, null);
+ $this->addColumn('eigentumer', 'Eigentumer', 'VARCHAR', true, 100, null);
+ $this->addColumn('zz_bei', 'ZzBei', 'VARCHAR', true, 100, null);
+ // validators
+ } // initialize()
+
+ /**
+ * Build the RelationMap objects for this table relationships
+ */
+ public function buildRelations()
+ {
+ } // buildRelations()
+
+} // WerkzeugTableMap
--- /dev/null
+<?php
+
+
+/**
+ * Skeleton subclass for representing a query for one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel.om
+ */
+class BaseHorbuchQuery extends MediumQuery {
+
+ /**
+ * Returns a new HorbuchQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return HorbuchQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof HorbuchQuery) {
+ return $criteria;
+ }
+ $query = new HorbuchQuery();
+ if (null !== $modelAlias) {
+ $query->setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Filters the query to target only Horbuch objects.
+ */
+ public function preSelect(PropelPDO $con)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_2);
+ }
+
+ /**
+ * Filters the query to target only Horbuch objects.
+ */
+ public function preUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_2);
+ }
+
+ /**
+ * Filters the query to target only Horbuch objects.
+ */
+ public function preDelete(PropelPDO $con)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_2);
+ }
+
+ /**
+ * Issue a DELETE query based on the current ModelCriteria deleting all rows in the table
+ * Having the Horbuch class.
+ * This method is called by ModelCriteria::deleteAll() inside a transaction
+ *
+ * @param PropelPDO $con a connection object
+ *
+ * @return integer the number of deleted rows
+ */
+ public function doDeleteAll($con)
+ {
+ // condition on class key is already added in preDelete()
+ return parent::doDelete($con);
+ }
+
+
+ /**
+ * Issue a SELECT ... LIMIT 1 query based on the current ModelCriteria
+ * and format the result with the current formatter
+ * By default, returns a model object
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return mixed the result, formatted by the current formatter
+ *
+ * @throws PropelException
+ */
+ public function findOneOrCreate($con = null)
+ {
+ if ($this->joins) {
+ throw new PropelException('findOneOrCreate() cannot be used on a query with a join, because Propel cannot transform a SQL JOIN into a subquery. You should split the query in two queries to avoid joins.');
+ }
+ if (!$ret = $this->findOne($con)) {
+ $class = MediumPeer::CLASSNAME_2;
+ $obj = new $class;
+ foreach ($this->keys() as $key) {
+ $obj->setByName($key, $this->getValue($key), BasePeer::TYPE_COLNAME);
+ }
+ $ret = $this->getFormatter()->formatRecord($obj);
+ }
+
+ return $ret;
+ }
+
+} // BaseHorbuchQuery
--- /dev/null
+<?php
+
+
+/**
+ * Skeleton subclass for representing a query for one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel.om
+ */
+class BaseKrimiQuery extends MediumQuery {
+
+ /**
+ * Returns a new KrimiQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return KrimiQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof KrimiQuery) {
+ return $criteria;
+ }
+ $query = new KrimiQuery();
+ if (null !== $modelAlias) {
+ $query->setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Filters the query to target only Krimi objects.
+ */
+ public function preSelect(PropelPDO $con)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_1);
+ }
+
+ /**
+ * Filters the query to target only Krimi objects.
+ */
+ public function preUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_1);
+ }
+
+ /**
+ * Filters the query to target only Krimi objects.
+ */
+ public function preDelete(PropelPDO $con)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_1);
+ }
+
+ /**
+ * Issue a DELETE query based on the current ModelCriteria deleting all rows in the table
+ * Having the Krimi class.
+ * This method is called by ModelCriteria::deleteAll() inside a transaction
+ *
+ * @param PropelPDO $con a connection object
+ *
+ * @return integer the number of deleted rows
+ */
+ public function doDeleteAll($con)
+ {
+ // condition on class key is already added in preDelete()
+ return parent::doDelete($con);
+ }
+
+
+ /**
+ * Issue a SELECT ... LIMIT 1 query based on the current ModelCriteria
+ * and format the result with the current formatter
+ * By default, returns a model object
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return mixed the result, formatted by the current formatter
+ *
+ * @throws PropelException
+ */
+ public function findOneOrCreate($con = null)
+ {
+ if ($this->joins) {
+ throw new PropelException('findOneOrCreate() cannot be used on a query with a join, because Propel cannot transform a SQL JOIN into a subquery. You should split the query in two queries to avoid joins.');
+ }
+ if (!$ret = $this->findOne($con)) {
+ $class = MediumPeer::CLASSNAME_1;
+ $obj = new $class;
+ foreach ($this->keys() as $key) {
+ $obj->setByName($key, $this->getValue($key), BasePeer::TYPE_COLNAME);
+ }
+ $ret = $this->getFormatter()->formatRecord($obj);
+ }
+
+ return $ret;
+ }
+
+} // BaseKrimiQuery
--- /dev/null
+<?php
+
+
+/**
+ * Base class that represents a row from the 'medium' table.
+ *
+ *
+ *
+ * @package propel.generator.propel.om
+ */
+abstract class BaseMedium extends BaseObject implements Persistent
+{
+ /**
+ * Peer class name
+ */
+ const PEER = 'MediumPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var MediumPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the mod field.
+ * @var int
+ */
+ protected $mod;
+
+ /**
+ * The value for the autor field.
+ * @var string
+ */
+ protected $autor;
+
+ /**
+ * The value for the titel field.
+ * @var string
+ */
+ protected $titel;
+
+ /**
+ * The value for the eigentumer field.
+ * @var string
+ */
+ protected $eigentumer;
+
+ /**
+ * The value for the zz_bei field.
+ * @var string
+ */
+ protected $zz_bei;
+
+ /**
+ * The value for the kommentar field.
+ * @var string
+ */
+ protected $kommentar;
+
+ /**
+ * The value for the class_key field.
+ * @var int
+ */
+ protected $class_key;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [mod] column value.
+ *
+ * @return int
+ */
+ public function getMod()
+ {
+
+ return $this->mod;
+ }
+
+ /**
+ * Get the [autor] column value.
+ *
+ * @return string
+ */
+ public function getAutor()
+ {
+
+ return $this->autor;
+ }
+
+ /**
+ * Get the [titel] column value.
+ *
+ * @return string
+ */
+ public function getTitel()
+ {
+
+ return $this->titel;
+ }
+
+ /**
+ * Get the [eigentumer] column value.
+ *
+ * @return string
+ */
+ public function getEigentumer()
+ {
+
+ return $this->eigentumer;
+ }
+
+ /**
+ * Get the [zz_bei] column value.
+ *
+ * @return string
+ */
+ public function getZzBei()
+ {
+
+ return $this->zz_bei;
+ }
+
+ /**
+ * Get the [kommentar] column value.
+ *
+ * @return string
+ */
+ public function getKommentar()
+ {
+
+ return $this->kommentar;
+ }
+
+ /**
+ * Get the [class_key] column value.
+ *
+ * @return int
+ */
+ public function getClassKey()
+ {
+
+ return $this->class_key;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = MediumPeer::ID;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [mod] column.
+ *
+ * @param int $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setMod($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->mod !== $v) {
+ $this->mod = $v;
+ $this->modifiedColumns[] = MediumPeer::MOD;
+ }
+
+
+ return $this;
+ } // setMod()
+
+ /**
+ * Set the value of [autor] column.
+ *
+ * @param string $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setAutor($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->autor !== $v) {
+ $this->autor = $v;
+ $this->modifiedColumns[] = MediumPeer::AUTOR;
+ }
+
+
+ return $this;
+ } // setAutor()
+
+ /**
+ * Set the value of [titel] column.
+ *
+ * @param string $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setTitel($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->titel !== $v) {
+ $this->titel = $v;
+ $this->modifiedColumns[] = MediumPeer::TITEL;
+ }
+
+
+ return $this;
+ } // setTitel()
+
+ /**
+ * Set the value of [eigentumer] column.
+ *
+ * @param string $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setEigentumer($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->eigentumer !== $v) {
+ $this->eigentumer = $v;
+ $this->modifiedColumns[] = MediumPeer::EIGENTUMER;
+ }
+
+
+ return $this;
+ } // setEigentumer()
+
+ /**
+ * Set the value of [zz_bei] column.
+ *
+ * @param string $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setZzBei($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->zz_bei !== $v) {
+ $this->zz_bei = $v;
+ $this->modifiedColumns[] = MediumPeer::ZZ_BEI;
+ }
+
+
+ return $this;
+ } // setZzBei()
+
+ /**
+ * Set the value of [kommentar] column.
+ *
+ * @param string $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setKommentar($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->kommentar !== $v) {
+ $this->kommentar = $v;
+ $this->modifiedColumns[] = MediumPeer::KOMMENTAR;
+ }
+
+
+ return $this;
+ } // setKommentar()
+
+ /**
+ * Set the value of [class_key] column.
+ *
+ * @param int $v new value
+ * @return Medium The current object (for fluent API support)
+ */
+ public function setClassKey($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->class_key !== $v) {
+ $this->class_key = $v;
+ $this->modifiedColumns[] = MediumPeer::CLASS_KEY;
+ }
+
+
+ return $this;
+ } // setClassKey()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which resultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->mod = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->autor = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->titel = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->eigentumer = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->zz_bei = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->kommentar = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
+ $this->class_key = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 8; // 8 = MediumPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Medium object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ 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(MediumPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = MediumPeer::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); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = MediumQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ 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(MediumPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ MediumPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = MediumPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . MediumPeer::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(MediumPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`id`';
+ }
+ if ($this->isColumnModified(MediumPeer::MOD)) {
+ $modifiedColumns[':p' . $index++] = '`mod`';
+ }
+ if ($this->isColumnModified(MediumPeer::AUTOR)) {
+ $modifiedColumns[':p' . $index++] = '`autor`';
+ }
+ if ($this->isColumnModified(MediumPeer::TITEL)) {
+ $modifiedColumns[':p' . $index++] = '`titel`';
+ }
+ if ($this->isColumnModified(MediumPeer::EIGENTUMER)) {
+ $modifiedColumns[':p' . $index++] = '`eigentumer`';
+ }
+ if ($this->isColumnModified(MediumPeer::ZZ_BEI)) {
+ $modifiedColumns[':p' . $index++] = '`zz_bei`';
+ }
+ if ($this->isColumnModified(MediumPeer::KOMMENTAR)) {
+ $modifiedColumns[':p' . $index++] = '`kommentar`';
+ }
+ if ($this->isColumnModified(MediumPeer::CLASS_KEY)) {
+ $modifiedColumns[':p' . $index++] = '`class_key`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `medium` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`id`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`mod`':
+ $stmt->bindValue($identifier, $this->mod, PDO::PARAM_INT);
+ break;
+ case '`autor`':
+ $stmt->bindValue($identifier, $this->autor, PDO::PARAM_STR);
+ break;
+ case '`titel`':
+ $stmt->bindValue($identifier, $this->titel, PDO::PARAM_STR);
+ break;
+ case '`eigentumer`':
+ $stmt->bindValue($identifier, $this->eigentumer, PDO::PARAM_STR);
+ break;
+ case '`zz_bei`':
+ $stmt->bindValue($identifier, $this->zz_bei, PDO::PARAM_STR);
+ break;
+ case '`kommentar`':
+ $stmt->bindValue($identifier, $this->kommentar, PDO::PARAM_STR);
+ break;
+ case '`class_key`':
+ $stmt->bindValue($identifier, $this->class_key, PDO::PARAM_INT);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ }
+
+ $this->validationFailures = $res;
+
+ return false;
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then <code>true</code> is returned; otherwise
+ * an aggregated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = MediumPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MediumPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getMod();
+ break;
+ case 2:
+ return $this->getAutor();
+ break;
+ case 3:
+ return $this->getTitel();
+ break;
+ case 4:
+ return $this->getEigentumer();
+ break;
+ case 5:
+ return $this->getZzBei();
+ break;
+ case 6:
+ return $this->getKommentar();
+ break;
+ case 7:
+ return $this->getClassKey();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['Medium'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['Medium'][$this->getPrimaryKey()] = true;
+ $keys = MediumPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getMod(),
+ $keys[2] => $this->getAutor(),
+ $keys[3] => $this->getTitel(),
+ $keys[4] => $this->getEigentumer(),
+ $keys[5] => $this->getZzBei(),
+ $keys[6] => $this->getKommentar(),
+ $keys[7] => $this->getClassKey(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = MediumPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setMod($value);
+ break;
+ case 2:
+ $this->setAutor($value);
+ break;
+ case 3:
+ $this->setTitel($value);
+ break;
+ case 4:
+ $this->setEigentumer($value);
+ break;
+ case 5:
+ $this->setZzBei($value);
+ break;
+ case 6:
+ $this->setKommentar($value);
+ break;
+ case 7:
+ $this->setClassKey($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = MediumPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setMod($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setAutor($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setTitel($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setEigentumer($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setZzBei($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setKommentar($arr[$keys[6]]);
+ if (array_key_exists($keys[7], $arr)) $this->setClassKey($arr[$keys[7]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(MediumPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(MediumPeer::ID)) $criteria->add(MediumPeer::ID, $this->id);
+ if ($this->isColumnModified(MediumPeer::MOD)) $criteria->add(MediumPeer::MOD, $this->mod);
+ if ($this->isColumnModified(MediumPeer::AUTOR)) $criteria->add(MediumPeer::AUTOR, $this->autor);
+ if ($this->isColumnModified(MediumPeer::TITEL)) $criteria->add(MediumPeer::TITEL, $this->titel);
+ if ($this->isColumnModified(MediumPeer::EIGENTUMER)) $criteria->add(MediumPeer::EIGENTUMER, $this->eigentumer);
+ if ($this->isColumnModified(MediumPeer::ZZ_BEI)) $criteria->add(MediumPeer::ZZ_BEI, $this->zz_bei);
+ if ($this->isColumnModified(MediumPeer::KOMMENTAR)) $criteria->add(MediumPeer::KOMMENTAR, $this->kommentar);
+ if ($this->isColumnModified(MediumPeer::CLASS_KEY)) $criteria->add(MediumPeer::CLASS_KEY, $this->class_key);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(MediumPeer::DATABASE_NAME);
+ $criteria->add(MediumPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of Medium (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setMod($this->getMod());
+ $copyObj->setAutor($this->getAutor());
+ $copyObj->setTitel($this->getTitel());
+ $copyObj->setEigentumer($this->getEigentumer());
+ $copyObj->setZzBei($this->getZzBei());
+ $copyObj->setKommentar($this->getKommentar());
+ $copyObj->setClassKey($this->getClassKey());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return Medium Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return MediumPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new MediumPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->mod = null;
+ $this->autor = null;
+ $this->titel = null;
+ $this->eigentumer = null;
+ $this->zz_bei = null;
+ $this->kommentar = null;
+ $this->class_key = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(MediumPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
--- /dev/null
+<?php
+
+
+/**
+ * Base static class for performing query and update operations on the 'medium' table.
+ *
+ *
+ *
+ * @package propel.generator.propel.om
+ */
+abstract class BaseMediumPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'mkrimi';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'medium';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'Medium';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'MediumTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 8;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 8;
+
+ /** the column name for the id field */
+ const ID = 'medium.id';
+
+ /** the column name for the mod field */
+ const MOD = 'medium.mod';
+
+ /** the column name for the autor field */
+ const AUTOR = 'medium.autor';
+
+ /** the column name for the titel field */
+ const TITEL = 'medium.titel';
+
+ /** the column name for the eigentumer field */
+ const EIGENTUMER = 'medium.eigentumer';
+
+ /** the column name for the zz_bei field */
+ const ZZ_BEI = 'medium.zz_bei';
+
+ /** the column name for the kommentar field */
+ const KOMMENTAR = 'medium.kommentar';
+
+ /** the column name for the class_key field */
+ const CLASS_KEY = 'medium.class_key';
+
+ /** A key representing a particular subclass */
+ const CLASSKEY_1 = '1';
+
+ /** A key representing a particular subclass */
+ const CLASSKEY_KRIMI = '1';
+
+ /** A class that can be returned by this peer. */
+ const CLASSNAME_1 = 'Krimi';
+
+ /** A key representing a particular subclass */
+ const CLASSKEY_2 = '2';
+
+ /** A key representing a particular subclass */
+ const CLASSKEY_HORBUCH = '2';
+
+ /** A class that can be returned by this peer. */
+ const CLASSNAME_2 = 'Horbuch';
+
+ /** A key representing a particular subclass */
+ const CLASSKEY_3 = '3';
+
+ /** A key representing a particular subclass */
+ const CLASSKEY_ROMAN = '3';
+
+ /** A class that can be returned by this peer. */
+ const CLASSNAME_3 = 'Roman';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of Medium objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array Medium[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. MediumPeer::$fieldNames[MediumPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Mod', 'Autor', 'Titel', 'Eigentumer', 'ZzBei', 'Kommentar', 'ClassKey', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'mod', 'autor', 'titel', 'eigentumer', 'zzBei', 'kommentar', 'classKey', ),
+ BasePeer::TYPE_COLNAME => array (MediumPeer::ID, MediumPeer::MOD, MediumPeer::AUTOR, MediumPeer::TITEL, MediumPeer::EIGENTUMER, MediumPeer::ZZ_BEI, MediumPeer::KOMMENTAR, MediumPeer::CLASS_KEY, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MOD', 'AUTOR', 'TITEL', 'EIGENTUMER', 'ZZ_BEI', 'KOMMENTAR', 'CLASS_KEY', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'mod', 'autor', 'titel', 'eigentumer', 'zz_bei', 'kommentar', 'class_key', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. MediumPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Mod' => 1, 'Autor' => 2, 'Titel' => 3, 'Eigentumer' => 4, 'ZzBei' => 5, 'Kommentar' => 6, 'ClassKey' => 7, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'mod' => 1, 'autor' => 2, 'titel' => 3, 'eigentumer' => 4, 'zzBei' => 5, 'kommentar' => 6, 'classKey' => 7, ),
+ BasePeer::TYPE_COLNAME => array (MediumPeer::ID => 0, MediumPeer::MOD => 1, MediumPeer::AUTOR => 2, MediumPeer::TITEL => 3, MediumPeer::EIGENTUMER => 4, MediumPeer::ZZ_BEI => 5, MediumPeer::KOMMENTAR => 6, MediumPeer::CLASS_KEY => 7, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MOD' => 1, 'AUTOR' => 2, 'TITEL' => 3, 'EIGENTUMER' => 4, 'ZZ_BEI' => 5, 'KOMMENTAR' => 6, 'CLASS_KEY' => 7, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mod' => 1, 'autor' => 2, 'titel' => 3, 'eigentumer' => 4, 'zz_bei' => 5, 'kommentar' => 6, 'class_key' => 7, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = MediumPeer::getFieldNames($toType);
+ $key = isset(MediumPeer::$fieldKeys[$fromType][$name]) ? MediumPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(MediumPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, MediumPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return MediumPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ * <code>
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ * </code>
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. MediumPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(MediumPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(MediumPeer::ID);
+ $criteria->addSelectColumn(MediumPeer::MOD);
+ $criteria->addSelectColumn(MediumPeer::AUTOR);
+ $criteria->addSelectColumn(MediumPeer::TITEL);
+ $criteria->addSelectColumn(MediumPeer::EIGENTUMER);
+ $criteria->addSelectColumn(MediumPeer::ZZ_BEI);
+ $criteria->addSelectColumn(MediumPeer::KOMMENTAR);
+ $criteria->addSelectColumn(MediumPeer::CLASS_KEY);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.mod');
+ $criteria->addSelectColumn($alias . '.autor');
+ $criteria->addSelectColumn($alias . '.titel');
+ $criteria->addSelectColumn($alias . '.eigentumer');
+ $criteria->addSelectColumn($alias . '.zz_bei');
+ $criteria->addSelectColumn($alias . '.kommentar');
+ $criteria->addSelectColumn($alias . '.class_key');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(MediumPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ MediumPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(MediumPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return Medium
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = MediumPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return MediumPeer::populateObjects(MediumPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement directly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ MediumPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(MediumPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param Medium $obj A Medium object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getId();
+ } // if key === null
+ MediumPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A Medium object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof Medium) {
+ $key = (string) $value->getId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Medium object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(MediumPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return Medium Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(MediumPeer::$instances[$key])) {
+ return MediumPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (MediumPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ MediumPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to medium
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = MediumPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = MediumPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ // class must be set each time from the record row
+ $cls = MediumPeer::getOMClass($row, 0);
+ $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1);
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ MediumPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (Medium object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = MediumPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = MediumPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + MediumPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = MediumPeer::getOMClass($row, $startcol);
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ MediumPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(MediumPeer::DATABASE_NAME)->getTable(MediumPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseMediumPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseMediumPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \MediumTableMap());
+ }
+ }
+
+ /**
+ * The returned Class will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @param array $row PropelPDO result row.
+ * @param int $colnum Column to examine for OM class information (first is 0).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ try {
+
+ $omClass = null;
+ $classKey = $row[$colnum + 7];
+
+ switch ($classKey) {
+
+ case MediumPeer::CLASSKEY_1:
+ $omClass = MediumPeer::CLASSNAME_1;
+ break;
+
+ case MediumPeer::CLASSKEY_2:
+ $omClass = MediumPeer::CLASSNAME_2;
+ break;
+
+ case MediumPeer::CLASSKEY_3:
+ $omClass = MediumPeer::CLASSNAME_3;
+ break;
+
+ default:
+ $omClass = MediumPeer::OM_CLASS;
+
+ } // switch
+
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get OM class.', $e);
+ }
+
+ return $omClass;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a Medium or Criteria object.
+ *
+ * @param mixed $values Criteria or Medium object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from Medium object
+ }
+
+ if ($criteria->containsKey(MediumPeer::ID) && $criteria->keyContainsValue(MediumPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.MediumPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(MediumPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a Medium or Criteria object.
+ *
+ * @param mixed $values Criteria or Medium object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(MediumPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(MediumPeer::ID);
+ $value = $criteria->remove(MediumPeer::ID);
+ if ($value) {
+ $selectCriteria->add(MediumPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(MediumPeer::TABLE_NAME);
+ }
+
+ } else { // $values is Medium object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(MediumPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the medium table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(MediumPeer::TABLE_NAME, $con, MediumPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ MediumPeer::clearInstancePool();
+ MediumPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a Medium or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or Medium object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ MediumPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof Medium) { // it's a model object
+ // invalidate the cache for this single object
+ MediumPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(MediumPeer::DATABASE_NAME);
+ $criteria->add(MediumPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ MediumPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(MediumPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ MediumPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given Medium object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param Medium $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(MediumPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(MediumPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(MediumPeer::DATABASE_NAME, MediumPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return Medium
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = MediumPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(MediumPeer::DATABASE_NAME);
+ $criteria->add(MediumPeer::ID, $pk);
+
+ $v = MediumPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @return Medium[]
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(MediumPeer::DATABASE_NAME);
+ $criteria->add(MediumPeer::ID, $pks, Criteria::IN);
+ $objs = MediumPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
+
+} // BaseMediumPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseMediumPeer::buildTableMap();
+
--- /dev/null
+<?php
+
+
+/**
+ * Base class that represents a query for the 'medium' table.
+ *
+ *
+ *
+ * @method MediumQuery orderById($order = Criteria::ASC) Order by the id column
+ * @method MediumQuery orderByMod($order = Criteria::ASC) Order by the mod column
+ * @method MediumQuery orderByAutor($order = Criteria::ASC) Order by the autor column
+ * @method MediumQuery orderByTitel($order = Criteria::ASC) Order by the titel column
+ * @method MediumQuery orderByEigentumer($order = Criteria::ASC) Order by the eigentumer column
+ * @method MediumQuery orderByZzBei($order = Criteria::ASC) Order by the zz_bei column
+ * @method MediumQuery orderByKommentar($order = Criteria::ASC) Order by the kommentar column
+ * @method MediumQuery orderByClassKey($order = Criteria::ASC) Order by the class_key column
+ *
+ * @method MediumQuery groupById() Group by the id column
+ * @method MediumQuery groupByMod() Group by the mod column
+ * @method MediumQuery groupByAutor() Group by the autor column
+ * @method MediumQuery groupByTitel() Group by the titel column
+ * @method MediumQuery groupByEigentumer() Group by the eigentumer column
+ * @method MediumQuery groupByZzBei() Group by the zz_bei column
+ * @method MediumQuery groupByKommentar() Group by the kommentar column
+ * @method MediumQuery groupByClassKey() Group by the class_key column
+ *
+ * @method MediumQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method MediumQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method MediumQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ *
+ * @method Medium findOne(PropelPDO $con = null) Return the first Medium matching the query
+ * @method Medium findOneOrCreate(PropelPDO $con = null) Return the first Medium matching the query, or a new Medium object populated from the query conditions when no match is found
+ *
+ * @method Medium findOneByMod(int $mod) Return the first Medium filtered by the mod column
+ * @method Medium findOneByAutor(string $autor) Return the first Medium filtered by the autor column
+ * @method Medium findOneByTitel(string $titel) Return the first Medium filtered by the titel column
+ * @method Medium findOneByEigentumer(string $eigentumer) Return the first Medium filtered by the eigentumer column
+ * @method Medium findOneByZzBei(string $zz_bei) Return the first Medium filtered by the zz_bei column
+ * @method Medium findOneByKommentar(string $kommentar) Return the first Medium filtered by the kommentar column
+ * @method Medium findOneByClassKey(int $class_key) Return the first Medium filtered by the class_key column
+ *
+ * @method array findById(int $id) Return Medium objects filtered by the id column
+ * @method array findByMod(int $mod) Return Medium objects filtered by the mod column
+ * @method array findByAutor(string $autor) Return Medium objects filtered by the autor column
+ * @method array findByTitel(string $titel) Return Medium objects filtered by the titel column
+ * @method array findByEigentumer(string $eigentumer) Return Medium objects filtered by the eigentumer column
+ * @method array findByZzBei(string $zz_bei) Return Medium objects filtered by the zz_bei column
+ * @method array findByKommentar(string $kommentar) Return Medium objects filtered by the kommentar column
+ * @method array findByClassKey(int $class_key) Return Medium objects filtered by the class_key column
+ *
+ * @package propel.generator.propel.om
+ */
+abstract class BaseMediumQuery extends ModelCriteria
+{
+ /**
+ * Initializes internal state of BaseMediumQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'mkrimi';
+ }
+ if (null === $modelName) {
+ $modelName = 'Medium';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
+
+ /**
+ * Returns a new MediumQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param MediumQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return MediumQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof MediumQuery) {
+ return $criteria;
+ }
+ $query = new MediumQuery(null, null, $modelAlias);
+
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ * <code>
+ * $obj = $c->findPk(12, $con);
+ * </code>
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Medium|Medium[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = MediumPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return Medium A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneById($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return Medium A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `id`, `mod`, `autor`, `titel`, `eigentumer`, `zz_bei`, `kommentar`, `class_key` FROM `medium` WHERE `id` = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $cls = MediumPeer::getOMClass($row, 0);
+ $obj = new $cls();
+ $obj->hydrate($row);
+ MediumPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return Medium|Medium[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ * <code>
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ * </code>
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|Medium[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(MediumPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(MediumPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id >= 12
+ * $query->filterById(array('max' => 12)); // WHERE id <= 12
+ * </code>
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id)) {
+ $useMinMax = false;
+ if (isset($id['min'])) {
+ $this->addUsingAlias(MediumPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(MediumPeer::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the mod column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByMod(1234); // WHERE mod = 1234
+ * $query->filterByMod(array(12, 34)); // WHERE mod IN (12, 34)
+ * $query->filterByMod(array('min' => 12)); // WHERE mod >= 12
+ * $query->filterByMod(array('max' => 12)); // WHERE mod <= 12
+ * </code>
+ *
+ * @param mixed $mod The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByMod($mod = null, $comparison = null)
+ {
+ if (is_array($mod)) {
+ $useMinMax = false;
+ if (isset($mod['min'])) {
+ $this->addUsingAlias(MediumPeer::MOD, $mod['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($mod['max'])) {
+ $this->addUsingAlias(MediumPeer::MOD, $mod['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::MOD, $mod, $comparison);
+ }
+
+ /**
+ * Filter the query on the autor column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByAutor('fooValue'); // WHERE autor = 'fooValue'
+ * $query->filterByAutor('%fooValue%'); // WHERE autor LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $autor The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByAutor($autor = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($autor)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $autor)) {
+ $autor = str_replace('*', '%', $autor);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::AUTOR, $autor, $comparison);
+ }
+
+ /**
+ * Filter the query on the titel column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByTitel('fooValue'); // WHERE titel = 'fooValue'
+ * $query->filterByTitel('%fooValue%'); // WHERE titel LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $titel The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByTitel($titel = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($titel)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $titel)) {
+ $titel = str_replace('*', '%', $titel);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::TITEL, $titel, $comparison);
+ }
+
+ /**
+ * Filter the query on the eigentumer column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByEigentumer('fooValue'); // WHERE eigentumer = 'fooValue'
+ * $query->filterByEigentumer('%fooValue%'); // WHERE eigentumer LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $eigentumer The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByEigentumer($eigentumer = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($eigentumer)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $eigentumer)) {
+ $eigentumer = str_replace('*', '%', $eigentumer);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::EIGENTUMER, $eigentumer, $comparison);
+ }
+
+ /**
+ * Filter the query on the zz_bei column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByZzBei('fooValue'); // WHERE zz_bei = 'fooValue'
+ * $query->filterByZzBei('%fooValue%'); // WHERE zz_bei LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $zzBei The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByZzBei($zzBei = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($zzBei)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $zzBei)) {
+ $zzBei = str_replace('*', '%', $zzBei);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::ZZ_BEI, $zzBei, $comparison);
+ }
+
+ /**
+ * Filter the query on the kommentar column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByKommentar('fooValue'); // WHERE kommentar = 'fooValue'
+ * $query->filterByKommentar('%fooValue%'); // WHERE kommentar LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $kommentar The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByKommentar($kommentar = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($kommentar)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $kommentar)) {
+ $kommentar = str_replace('*', '%', $kommentar);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::KOMMENTAR, $kommentar, $comparison);
+ }
+
+ /**
+ * Filter the query on the class_key column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByClassKey(1234); // WHERE class_key = 1234
+ * $query->filterByClassKey(array(12, 34)); // WHERE class_key IN (12, 34)
+ * $query->filterByClassKey(array('min' => 12)); // WHERE class_key >= 12
+ * $query->filterByClassKey(array('max' => 12)); // WHERE class_key <= 12
+ * </code>
+ *
+ * @param mixed $classKey The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function filterByClassKey($classKey = null, $comparison = null)
+ {
+ if (is_array($classKey)) {
+ $useMinMax = false;
+ if (isset($classKey['min'])) {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, $classKey['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($classKey['max'])) {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, $classKey['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(MediumPeer::CLASS_KEY, $classKey, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param Medium $medium Object to remove from the list of results
+ *
+ * @return MediumQuery The current query, for fluid interface
+ */
+ public function prune($medium = null)
+ {
+ if ($medium) {
+ $this->addUsingAlias(MediumPeer::ID, $medium->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
--- /dev/null
+<?php
+
+
+/**
+ * Skeleton subclass for representing a query for one of the subclasses of the 'medium' table.
+ *
+ *
+ *
+ * You should add additional methods to this class to meet the
+ * application requirements. This class will only be generated as
+ * long as it does not already exist in the output directory.
+ *
+ * @package propel.generator.propel.om
+ */
+class BaseRomanQuery extends MediumQuery {
+
+ /**
+ * Returns a new RomanQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return RomanQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof RomanQuery) {
+ return $criteria;
+ }
+ $query = new RomanQuery();
+ if (null !== $modelAlias) {
+ $query->setModelAlias($modelAlias);
+ }
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Filters the query to target only Roman objects.
+ */
+ public function preSelect(PropelPDO $con)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_3);
+ }
+
+ /**
+ * Filters the query to target only Roman objects.
+ */
+ public function preUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_3);
+ }
+
+ /**
+ * Filters the query to target only Roman objects.
+ */
+ public function preDelete(PropelPDO $con)
+ {
+ $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_3);
+ }
+
+ /**
+ * Issue a DELETE query based on the current ModelCriteria deleting all rows in the table
+ * Having the Roman class.
+ * This method is called by ModelCriteria::deleteAll() inside a transaction
+ *
+ * @param PropelPDO $con a connection object
+ *
+ * @return integer the number of deleted rows
+ */
+ public function doDeleteAll($con)
+ {
+ // condition on class key is already added in preDelete()
+ return parent::doDelete($con);
+ }
+
+
+ /**
+ * Issue a SELECT ... LIMIT 1 query based on the current ModelCriteria
+ * and format the result with the current formatter
+ * By default, returns a model object
+ *
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return mixed the result, formatted by the current formatter
+ *
+ * @throws PropelException
+ */
+ public function findOneOrCreate($con = null)
+ {
+ if ($this->joins) {
+ throw new PropelException('findOneOrCreate() cannot be used on a query with a join, because Propel cannot transform a SQL JOIN into a subquery. You should split the query in two queries to avoid joins.');
+ }
+ if (!$ret = $this->findOne($con)) {
+ $class = MediumPeer::CLASSNAME_3;
+ $obj = new $class;
+ foreach ($this->keys() as $key) {
+ $obj->setByName($key, $this->getValue($key), BasePeer::TYPE_COLNAME);
+ }
+ $ret = $this->getFormatter()->formatRecord($obj);
+ }
+
+ return $ret;
+ }
+
+} // BaseRomanQuery
--- /dev/null
+<?php
+
+
+/**
+ * Base class that represents a row from the 'werkzeug' table.
+ *
+ *
+ *
+ * @package propel.generator.propel.om
+ */
+abstract class BaseWerkzeug extends BaseObject implements Persistent
+{
+ /**
+ * Peer class name
+ */
+ const PEER = 'WerkzeugPeer';
+
+ /**
+ * The Peer class.
+ * Instance provides a convenient way of calling static methods on a class
+ * that calling code may not be able to identify.
+ * @var WerkzeugPeer
+ */
+ protected static $peer;
+
+ /**
+ * The flag var to prevent infinite loop in deep copy
+ * @var boolean
+ */
+ protected $startCopy = false;
+
+ /**
+ * The value for the id field.
+ * @var int
+ */
+ protected $id;
+
+ /**
+ * The value for the mod field.
+ * @var int
+ */
+ protected $mod;
+
+ /**
+ * The value for the typ field.
+ * @var string
+ */
+ protected $typ;
+
+ /**
+ * The value for the beschreibung field.
+ * @var string
+ */
+ protected $beschreibung;
+
+ /**
+ * The value for the eigentumer field.
+ * @var string
+ */
+ protected $eigentumer;
+
+ /**
+ * The value for the zz_bei field.
+ * @var string
+ */
+ protected $zz_bei;
+
+ /**
+ * Flag to prevent endless save loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInSave = false;
+
+ /**
+ * Flag to prevent endless validation loop, if this object is referenced
+ * by another object which falls in this transaction.
+ * @var boolean
+ */
+ protected $alreadyInValidation = false;
+
+ /**
+ * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
+ * @var boolean
+ */
+ protected $alreadyInClearAllReferencesDeep = false;
+
+ /**
+ * Get the [id] column value.
+ *
+ * @return int
+ */
+ public function getId()
+ {
+
+ return $this->id;
+ }
+
+ /**
+ * Get the [mod] column value.
+ *
+ * @return int
+ */
+ public function getMod()
+ {
+
+ return $this->mod;
+ }
+
+ /**
+ * Get the [typ] column value.
+ *
+ * @return string
+ */
+ public function getTyp()
+ {
+
+ return $this->typ;
+ }
+
+ /**
+ * Get the [beschreibung] column value.
+ *
+ * @return string
+ */
+ public function getBeschreibung()
+ {
+
+ return $this->beschreibung;
+ }
+
+ /**
+ * Get the [eigentumer] column value.
+ *
+ * @return string
+ */
+ public function getEigentumer()
+ {
+
+ return $this->eigentumer;
+ }
+
+ /**
+ * Get the [zz_bei] column value.
+ *
+ * @return string
+ */
+ public function getZzBei()
+ {
+
+ return $this->zz_bei;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return Werkzeug The current object (for fluent API support)
+ */
+ public function setId($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = WerkzeugPeer::ID;
+ }
+
+
+ return $this;
+ } // setId()
+
+ /**
+ * Set the value of [mod] column.
+ *
+ * @param int $v new value
+ * @return Werkzeug The current object (for fluent API support)
+ */
+ public function setMod($v)
+ {
+ if ($v !== null && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->mod !== $v) {
+ $this->mod = $v;
+ $this->modifiedColumns[] = WerkzeugPeer::MOD;
+ }
+
+
+ return $this;
+ } // setMod()
+
+ /**
+ * Set the value of [typ] column.
+ *
+ * @param string $v new value
+ * @return Werkzeug The current object (for fluent API support)
+ */
+ public function setTyp($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->typ !== $v) {
+ $this->typ = $v;
+ $this->modifiedColumns[] = WerkzeugPeer::TYP;
+ }
+
+
+ return $this;
+ } // setTyp()
+
+ /**
+ * Set the value of [beschreibung] column.
+ *
+ * @param string $v new value
+ * @return Werkzeug The current object (for fluent API support)
+ */
+ public function setBeschreibung($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->beschreibung !== $v) {
+ $this->beschreibung = $v;
+ $this->modifiedColumns[] = WerkzeugPeer::BESCHREIBUNG;
+ }
+
+
+ return $this;
+ } // setBeschreibung()
+
+ /**
+ * Set the value of [eigentumer] column.
+ *
+ * @param string $v new value
+ * @return Werkzeug The current object (for fluent API support)
+ */
+ public function setEigentumer($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->eigentumer !== $v) {
+ $this->eigentumer = $v;
+ $this->modifiedColumns[] = WerkzeugPeer::EIGENTUMER;
+ }
+
+
+ return $this;
+ } // setEigentumer()
+
+ /**
+ * Set the value of [zz_bei] column.
+ *
+ * @param string $v new value
+ * @return Werkzeug The current object (for fluent API support)
+ */
+ public function setZzBei($v)
+ {
+ if ($v !== null) {
+ $v = (string) $v;
+ }
+
+ if ($this->zz_bei !== $v) {
+ $this->zz_bei = $v;
+ $this->modifiedColumns[] = WerkzeugPeer::ZZ_BEI;
+ }
+
+
+ return $this;
+ } // setZzBei()
+
+ /**
+ * Indicates whether the columns in this object are only set to default values.
+ *
+ * This method can be used in conjunction with isModified() to indicate whether an object is both
+ * modified _and_ has some values set which are non-default.
+ *
+ * @return boolean Whether the columns in this object are only been set with default values.
+ */
+ public function hasOnlyDefaultValues()
+ {
+ // otherwise, everything was equal, so return true
+ return true;
+ } // hasOnlyDefaultValues()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (0-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
+ * @param int $startcol 0-based offset column which indicates which resultset column to start with.
+ * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate($row, $startcol = 0, $rehydrate = false)
+ {
+ try {
+
+ $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
+ $this->mod = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
+ $this->typ = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
+ $this->beschreibung = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
+ $this->eigentumer = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
+ $this->zz_bei = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ if ($rehydrate) {
+ $this->ensureConsistency();
+ }
+ $this->postHydrate($row, $startcol, $rehydrate);
+
+ return $startcol + 6; // 6 = WerkzeugPeer::NUM_HYDRATE_COLUMNS.
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating Werkzeug object", $e);
+ }
+ }
+
+ /**
+ * Checks and repairs the internal consistency of the object.
+ *
+ * This method is executed after an already-instantiated object is re-hydrated
+ * from the database. It exists to check any foreign keys to make sure that
+ * the objects related to the current object are correct based on foreign key.
+ *
+ * You can override this method in the stub class, but you should always invoke
+ * the base method from the overridden method (i.e. parent::ensureConsistency()),
+ * in case your model changes.
+ *
+ * @throws PropelException
+ */
+ public function ensureConsistency()
+ {
+
+ } // ensureConsistency
+
+ /**
+ * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
+ *
+ * This will only work if the object has been saved and has a valid primary key set.
+ *
+ * @param boolean $deep (optional) Whether to also de-associated any related objects.
+ * @param PropelPDO $con (optional) The PropelPDO connection to use.
+ * @return void
+ * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
+ */
+ 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(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ // We don't need to alter the object instance pool; we're just modifying this instance
+ // already in the pool.
+
+ $stmt = WerkzeugPeer::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); // rehydrate
+
+ if ($deep) { // also de-associate any related objects?
+
+ } // if (deep)
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param PropelPDO $con
+ * @return void
+ * @throws PropelException
+ * @throws Exception
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete(PropelPDO $con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ try {
+ $deleteQuery = WerkzeugQuery::create()
+ ->filterByPrimaryKey($this->getPrimaryKey());
+ $ret = $this->preDelete($con);
+ if ($ret) {
+ $deleteQuery->delete($con);
+ $this->postDelete($con);
+ $con->commit();
+ $this->setDeleted(true);
+ } else {
+ $con->commit();
+ }
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Persists this object to the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All modified related objects will also be persisted in the doSave()
+ * method. This method wraps all precipitate database operations in a
+ * single transaction.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @throws Exception
+ * @see doSave()
+ */
+ 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(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $con->beginTransaction();
+ $isInsert = $this->isNew();
+ try {
+ $ret = $this->preSave($con);
+ if ($isInsert) {
+ $ret = $ret && $this->preInsert($con);
+ } else {
+ $ret = $ret && $this->preUpdate($con);
+ }
+ if ($ret) {
+ $affectedRows = $this->doSave($con);
+ if ($isInsert) {
+ $this->postInsert($con);
+ } else {
+ $this->postUpdate($con);
+ }
+ $this->postSave($con);
+ WerkzeugPeer::addInstanceToPool($this);
+ } else {
+ $affectedRows = 0;
+ }
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs the work of inserting or updating the row in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param PropelPDO $con
+ * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave(PropelPDO $con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+ if ($this->isNew() || $this->isModified()) {
+ // persist changes
+ if ($this->isNew()) {
+ $this->doInsert($con);
+ } else {
+ $this->doUpdate($con);
+ }
+ $affectedRows += 1;
+ $this->resetModified();
+ }
+
+ $this->alreadyInSave = false;
+
+ }
+
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Insert the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @throws PropelException
+ * @see doSave()
+ */
+ protected function doInsert(PropelPDO $con)
+ {
+ $modifiedColumns = array();
+ $index = 0;
+
+ $this->modifiedColumns[] = WerkzeugPeer::ID;
+ if (null !== $this->id) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key (' . WerkzeugPeer::ID . ')');
+ }
+
+ // check the columns in natural order for more readable SQL queries
+ if ($this->isColumnModified(WerkzeugPeer::ID)) {
+ $modifiedColumns[':p' . $index++] = '`id`';
+ }
+ if ($this->isColumnModified(WerkzeugPeer::MOD)) {
+ $modifiedColumns[':p' . $index++] = '`mod`';
+ }
+ if ($this->isColumnModified(WerkzeugPeer::TYP)) {
+ $modifiedColumns[':p' . $index++] = '`typ`';
+ }
+ if ($this->isColumnModified(WerkzeugPeer::BESCHREIBUNG)) {
+ $modifiedColumns[':p' . $index++] = '`beschreibung`';
+ }
+ if ($this->isColumnModified(WerkzeugPeer::EIGENTUMER)) {
+ $modifiedColumns[':p' . $index++] = '`eigentumer`';
+ }
+ if ($this->isColumnModified(WerkzeugPeer::ZZ_BEI)) {
+ $modifiedColumns[':p' . $index++] = '`zz_bei`';
+ }
+
+ $sql = sprintf(
+ 'INSERT INTO `werkzeug` (%s) VALUES (%s)',
+ implode(', ', $modifiedColumns),
+ implode(', ', array_keys($modifiedColumns))
+ );
+
+ try {
+ $stmt = $con->prepare($sql);
+ foreach ($modifiedColumns as $identifier => $columnName) {
+ switch ($columnName) {
+ case '`id`':
+ $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
+ break;
+ case '`mod`':
+ $stmt->bindValue($identifier, $this->mod, PDO::PARAM_INT);
+ break;
+ case '`typ`':
+ $stmt->bindValue($identifier, $this->typ, PDO::PARAM_STR);
+ break;
+ case '`beschreibung`':
+ $stmt->bindValue($identifier, $this->beschreibung, PDO::PARAM_STR);
+ break;
+ case '`eigentumer`':
+ $stmt->bindValue($identifier, $this->eigentumer, PDO::PARAM_STR);
+ break;
+ case '`zz_bei`':
+ $stmt->bindValue($identifier, $this->zz_bei, PDO::PARAM_STR);
+ break;
+ }
+ }
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
+ }
+
+ try {
+ $pk = $con->lastInsertId();
+ } catch (Exception $e) {
+ throw new PropelException('Unable to get autoincrement id.', $e);
+ }
+ $this->setId($pk);
+
+ $this->setNew(false);
+ }
+
+ /**
+ * Update the row in the database.
+ *
+ * @param PropelPDO $con
+ *
+ * @see doSave()
+ */
+ protected function doUpdate(PropelPDO $con)
+ {
+ $selectCriteria = $this->buildPkeyCriteria();
+ $valuesCriteria = $this->buildCriteria();
+ BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
+ }
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+
+ return true;
+ }
+
+ $this->validationFailures = $res;
+
+ return false;
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then <code>true</code> is returned; otherwise
+ * an aggregated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = WerkzeugPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = WerkzeugPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ $field = $this->getByPosition($pos);
+
+ return $field;
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch ($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getMod();
+ break;
+ case 2:
+ return $this->getTyp();
+ break;
+ case 3:
+ return $this->getBeschreibung();
+ break;
+ case 4:
+ return $this->getEigentumer();
+ break;
+ case 5:
+ return $this->getZzBei();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME.
+ * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
+ * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
+ *
+ * @return array an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
+ {
+ if (isset($alreadyDumpedObjects['Werkzeug'][$this->getPrimaryKey()])) {
+ return '*RECURSION*';
+ }
+ $alreadyDumpedObjects['Werkzeug'][$this->getPrimaryKey()] = true;
+ $keys = WerkzeugPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getMod(),
+ $keys[2] => $this->getTyp(),
+ $keys[3] => $this->getBeschreibung(),
+ $keys[4] => $this->getEigentumer(),
+ $keys[5] => $this->getZzBei(),
+ );
+ $virtualColumns = $this->virtualColumns;
+ foreach ($virtualColumns as $key => $virtualColumn) {
+ $result[$key] = $virtualColumn;
+ }
+
+
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * Defaults to BasePeer::TYPE_PHPNAME
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = WerkzeugPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+
+ $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch ($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setMod($value);
+ break;
+ case 2:
+ $this->setTyp($value);
+ break;
+ case 3:
+ $this->setBeschreibung($value);
+ break;
+ case 4:
+ $this->setEigentumer($value);
+ break;
+ case 5:
+ $this->setZzBei($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
+ * The default key type is the column's BasePeer::TYPE_PHPNAME
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = WerkzeugPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
+ if (array_key_exists($keys[1], $arr)) $this->setMod($arr[$keys[1]]);
+ if (array_key_exists($keys[2], $arr)) $this->setTyp($arr[$keys[2]]);
+ if (array_key_exists($keys[3], $arr)) $this->setBeschreibung($arr[$keys[3]]);
+ if (array_key_exists($keys[4], $arr)) $this->setEigentumer($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setZzBei($arr[$keys[5]]);
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(WerkzeugPeer::ID)) $criteria->add(WerkzeugPeer::ID, $this->id);
+ if ($this->isColumnModified(WerkzeugPeer::MOD)) $criteria->add(WerkzeugPeer::MOD, $this->mod);
+ if ($this->isColumnModified(WerkzeugPeer::TYP)) $criteria->add(WerkzeugPeer::TYP, $this->typ);
+ if ($this->isColumnModified(WerkzeugPeer::BESCHREIBUNG)) $criteria->add(WerkzeugPeer::BESCHREIBUNG, $this->beschreibung);
+ if ($this->isColumnModified(WerkzeugPeer::EIGENTUMER)) $criteria->add(WerkzeugPeer::EIGENTUMER, $this->eigentumer);
+ if ($this->isColumnModified(WerkzeugPeer::ZZ_BEI)) $criteria->add(WerkzeugPeer::ZZ_BEI, $this->zz_bei);
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
+ $criteria->add(WerkzeugPeer::ID, $this->id);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return int
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getId();
+ }
+
+ /**
+ * Generic method to set the primary key (id column).
+ *
+ * @param int $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setId($key);
+ }
+
+ /**
+ * Returns true if the primary key for this object is null.
+ * @return boolean
+ */
+ public function isPrimaryKeyNull()
+ {
+
+ return null === $this->getId();
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of Werkzeug (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
+ {
+ $copyObj->setMod($this->getMod());
+ $copyObj->setTyp($this->getTyp());
+ $copyObj->setBeschreibung($this->getBeschreibung());
+ $copyObj->setEigentumer($this->getEigentumer());
+ $copyObj->setZzBei($this->getZzBei());
+ if ($makeNew) {
+ $copyObj->setNew(true);
+ $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
+ }
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return Werkzeug Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return WerkzeugPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new WerkzeugPeer();
+ }
+
+ return self::$peer;
+ }
+
+ /**
+ * Clears the current object and sets all attributes to their default values
+ */
+ public function clear()
+ {
+ $this->id = null;
+ $this->mod = null;
+ $this->typ = null;
+ $this->beschreibung = null;
+ $this->eigentumer = null;
+ $this->zz_bei = null;
+ $this->alreadyInSave = false;
+ $this->alreadyInValidation = false;
+ $this->alreadyInClearAllReferencesDeep = false;
+ $this->clearAllReferences();
+ $this->resetModified();
+ $this->setNew(true);
+ $this->setDeleted(false);
+ }
+
+ /**
+ * Resets all references to other model objects or collections of model objects.
+ *
+ * This method is a user-space workaround for PHP's inability to garbage collect
+ * objects with circular references (even in PHP 5.3). This is currently necessary
+ * when using Propel in certain daemon or large-volume/high-memory operations.
+ *
+ * @param boolean $deep Whether to also clear the references on all referrer objects.
+ */
+ public function clearAllReferences($deep = false)
+ {
+ if ($deep && !$this->alreadyInClearAllReferencesDeep) {
+ $this->alreadyInClearAllReferencesDeep = true;
+
+ $this->alreadyInClearAllReferencesDeep = false;
+ } // if ($deep)
+
+ }
+
+ /**
+ * return the string representation of this object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return (string) $this->exportTo(WerkzeugPeer::DEFAULT_STRING_FORMAT);
+ }
+
+ /**
+ * return true is the object is in saving state
+ *
+ * @return boolean
+ */
+ public function isAlreadyInSave()
+ {
+ return $this->alreadyInSave;
+ }
+
+}
--- /dev/null
+<?php
+
+
+/**
+ * Base static class for performing query and update operations on the 'werkzeug' table.
+ *
+ *
+ *
+ * @package propel.generator.propel.om
+ */
+abstract class BaseWerkzeugPeer
+{
+
+ /** the default database name for this class */
+ const DATABASE_NAME = 'mkrimi';
+
+ /** the table name for this class */
+ const TABLE_NAME = 'werkzeug';
+
+ /** the related Propel class for this table */
+ const OM_CLASS = 'Werkzeug';
+
+ /** the related TableMap class for this table */
+ const TM_CLASS = 'WerkzeugTableMap';
+
+ /** The total number of columns. */
+ const NUM_COLUMNS = 6;
+
+ /** The number of lazy-loaded columns. */
+ const NUM_LAZY_LOAD_COLUMNS = 0;
+
+ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
+ const NUM_HYDRATE_COLUMNS = 6;
+
+ /** the column name for the id field */
+ const ID = 'werkzeug.id';
+
+ /** the column name for the mod field */
+ const MOD = 'werkzeug.mod';
+
+ /** the column name for the typ field */
+ const TYP = 'werkzeug.typ';
+
+ /** the column name for the beschreibung field */
+ const BESCHREIBUNG = 'werkzeug.beschreibung';
+
+ /** the column name for the eigentumer field */
+ const EIGENTUMER = 'werkzeug.eigentumer';
+
+ /** the column name for the zz_bei field */
+ const ZZ_BEI = 'werkzeug.zz_bei';
+
+ /** The default string format for model objects of the related table **/
+ const DEFAULT_STRING_FORMAT = 'YAML';
+
+ /**
+ * An identity map to hold any loaded instances of Werkzeug objects.
+ * This must be public so that other peer classes can access this when hydrating from JOIN
+ * queries.
+ * @var array Werkzeug[]
+ */
+ public static $instances = array();
+
+
+ /**
+ * holds an array of fieldnames
+ *
+ * first dimension keys are the type constants
+ * e.g. WerkzeugPeer::$fieldNames[WerkzeugPeer::TYPE_PHPNAME][0] = 'Id'
+ */
+ protected static $fieldNames = array (
+ BasePeer::TYPE_PHPNAME => array ('Id', 'Mod', 'Typ', 'Beschreibung', 'Eigentumer', 'ZzBei', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'mod', 'typ', 'beschreibung', 'eigentumer', 'zzBei', ),
+ BasePeer::TYPE_COLNAME => array (WerkzeugPeer::ID, WerkzeugPeer::MOD, WerkzeugPeer::TYP, WerkzeugPeer::BESCHREIBUNG, WerkzeugPeer::EIGENTUMER, WerkzeugPeer::ZZ_BEI, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'MOD', 'TYP', 'BESCHREIBUNG', 'EIGENTUMER', 'ZZ_BEI', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'mod', 'typ', 'beschreibung', 'eigentumer', 'zz_bei', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. WerkzeugPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ protected static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Mod' => 1, 'Typ' => 2, 'Beschreibung' => 3, 'Eigentumer' => 4, 'ZzBei' => 5, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'mod' => 1, 'typ' => 2, 'beschreibung' => 3, 'eigentumer' => 4, 'zzBei' => 5, ),
+ BasePeer::TYPE_COLNAME => array (WerkzeugPeer::ID => 0, WerkzeugPeer::MOD => 1, WerkzeugPeer::TYP => 2, WerkzeugPeer::BESCHREIBUNG => 3, WerkzeugPeer::EIGENTUMER => 4, WerkzeugPeer::ZZ_BEI => 5, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'MOD' => 1, 'TYP' => 2, 'BESCHREIBUNG' => 3, 'EIGENTUMER' => 4, 'ZZ_BEI' => 5, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'mod' => 1, 'typ' => 2, 'beschreibung' => 3, 'eigentumer' => 4, 'zz_bei' => 5, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
+ );
+
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ * @throws PropelException - if the specified name could not be found in the fieldname mappings.
+ */
+ public static function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = WerkzeugPeer::getFieldNames($toType);
+ $key = isset(WerkzeugPeer::$fieldKeys[$fromType][$name]) ? WerkzeugPeer::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(WerkzeugPeer::$fieldKeys[$fromType], true));
+ }
+
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
+ * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
+ * @return array A list of field names
+ * @throws PropelException - if the type is not valid.
+ */
+ public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, WerkzeugPeer::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
+ }
+
+ return WerkzeugPeer::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ * <code>
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ * </code>
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. WerkzeugPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(WerkzeugPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param Criteria $criteria object containing the columns to add.
+ * @param string $alias optional table alias
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria, $alias = null)
+ {
+ if (null === $alias) {
+ $criteria->addSelectColumn(WerkzeugPeer::ID);
+ $criteria->addSelectColumn(WerkzeugPeer::MOD);
+ $criteria->addSelectColumn(WerkzeugPeer::TYP);
+ $criteria->addSelectColumn(WerkzeugPeer::BESCHREIBUNG);
+ $criteria->addSelectColumn(WerkzeugPeer::EIGENTUMER);
+ $criteria->addSelectColumn(WerkzeugPeer::ZZ_BEI);
+ } else {
+ $criteria->addSelectColumn($alias . '.id');
+ $criteria->addSelectColumn($alias . '.mod');
+ $criteria->addSelectColumn($alias . '.typ');
+ $criteria->addSelectColumn($alias . '.beschreibung');
+ $criteria->addSelectColumn($alias . '.eigentumer');
+ $criteria->addSelectColumn($alias . '.zz_bei');
+ }
+ }
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
+ * @param PropelPDO $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
+ {
+ // we may modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // We need to set the primary table name, since in the case that there are no WHERE columns
+ // it will be impossible for the BasePeer::createSelectSql() method to determine which
+ // tables go into the FROM clause.
+ $criteria->setPrimaryTableName(WerkzeugPeer::TABLE_NAME);
+
+ if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->setDistinct();
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ WerkzeugPeer::addSelectColumns($criteria);
+ }
+
+ $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
+ $criteria->setDbName(WerkzeugPeer::DATABASE_NAME); // Set the correct dbName
+
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ // BasePeer returns a PDOStatement
+ $stmt = BasePeer::doCount($criteria, $con);
+
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $count = (int) $row[0];
+ } else {
+ $count = 0; // no rows returned; we infer that means 0 matches.
+ }
+ $stmt->closeCursor();
+
+ return $count;
+ }
+ /**
+ * Selects one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param PropelPDO $con
+ * @return Werkzeug
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = WerkzeugPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+
+ return null;
+ }
+ /**
+ * Selects several row from the DB.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, PropelPDO $con = null)
+ {
+ return WerkzeugPeer::populateObjects(WerkzeugPeer::doSelectStmt($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
+ *
+ * Use this method directly if you want to work with an executed statement directly (for example
+ * to perform your own object hydration).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param PropelPDO $con The connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return PDOStatement The executed PDOStatement object.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ if (!$criteria->hasSelectClause()) {
+ $criteria = clone $criteria;
+ WerkzeugPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(WerkzeugPeer::DATABASE_NAME);
+
+ // BasePeer returns a PDOStatement
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * Adds an object to the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doSelect*()
+ * methods in your stub classes -- you may need to explicitly add objects
+ * to the cache in order to ensure that the same objects are always returned by doSelect*()
+ * and retrieveByPK*() calls.
+ *
+ * @param Werkzeug $obj A Werkzeug object.
+ * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
+ */
+ public static function addInstanceToPool($obj, $key = null)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if ($key === null) {
+ $key = (string) $obj->getId();
+ } // if key === null
+ WerkzeugPeer::$instances[$key] = $obj;
+ }
+ }
+
+ /**
+ * Removes an object from the instance pool.
+ *
+ * Propel keeps cached copies of objects in an instance pool when they are retrieved
+ * from the database. In some cases -- especially when you override doDelete
+ * methods in your stub classes -- you may need to explicitly remove objects
+ * from the cache in order to prevent returning objects that no longer exist.
+ *
+ * @param mixed $value A Werkzeug object or a primary key value.
+ *
+ * @return void
+ * @throws PropelException - if the value is invalid.
+ */
+ public static function removeInstanceFromPool($value)
+ {
+ if (Propel::isInstancePoolingEnabled() && $value !== null) {
+ if (is_object($value) && $value instanceof Werkzeug) {
+ $key = (string) $value->getId();
+ } elseif (is_scalar($value)) {
+ // assume we've been passed a primary key
+ $key = (string) $value;
+ } else {
+ $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Werkzeug object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
+ throw $e;
+ }
+
+ unset(WerkzeugPeer::$instances[$key]);
+ }
+ } // removeInstanceFromPool()
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
+ * @return Werkzeug Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
+ * @see getPrimaryKeyHash()
+ */
+ public static function getInstanceFromPool($key)
+ {
+ if (Propel::isInstancePoolingEnabled()) {
+ if (isset(WerkzeugPeer::$instances[$key])) {
+ return WerkzeugPeer::$instances[$key];
+ }
+ }
+
+ return null; // just to be explicit
+ }
+
+ /**
+ * Clear the instance pool.
+ *
+ * @return void
+ */
+ public static function clearInstancePool($and_clear_all_references = false)
+ {
+ if ($and_clear_all_references) {
+ foreach (WerkzeugPeer::$instances as $instance) {
+ $instance->clearAllReferences(true);
+ }
+ }
+ WerkzeugPeer::$instances = array();
+ }
+
+ /**
+ * Method to invalidate the instance pool of all tables related to werkzeug
+ * by a foreign key with ON DELETE CASCADE
+ */
+ public static function clearRelatedInstancePool()
+ {
+ }
+
+ /**
+ * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
+ *
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, a serialize()d version of the primary key will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return string A string version of PK or null if the components of primary key in result array are all null.
+ */
+ public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
+ {
+ // If the PK cannot be derived from the row, return null.
+ if ($row[$startcol] === null) {
+ return null;
+ }
+
+ return (string) $row[$startcol];
+ }
+
+ /**
+ * Retrieves the primary key from the DB resultset row
+ * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
+ * a multi-column primary key, an array of the primary key columns will be returned.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @return mixed The primary key of the row
+ */
+ public static function getPrimaryKeyFromRow($row, $startcol = 0)
+ {
+
+ return (int) $row[$startcol];
+ }
+
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(PDOStatement $stmt)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = WerkzeugPeer::getOMClass();
+ // populate the object(s)
+ while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $key = WerkzeugPeer::getPrimaryKeyHashFromRow($row, 0);
+ if (null !== ($obj = WerkzeugPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, 0, true); // rehydrate
+ $results[] = $obj;
+ } else {
+ $obj = new $cls();
+ $obj->hydrate($row);
+ $results[] = $obj;
+ WerkzeugPeer::addInstanceToPool($obj, $key);
+ } // if key exists
+ }
+ $stmt->closeCursor();
+
+ return $results;
+ }
+ /**
+ * Populates an object of the default type or an object that inherit from the default.
+ *
+ * @param array $row PropelPDO resultset row.
+ * @param int $startcol The 0-based offset for reading from the resultset row.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return array (Werkzeug object, last column rank)
+ */
+ public static function populateObject($row, $startcol = 0)
+ {
+ $key = WerkzeugPeer::getPrimaryKeyHashFromRow($row, $startcol);
+ if (null !== ($obj = WerkzeugPeer::getInstanceFromPool($key))) {
+ // We no longer rehydrate the object, since this can cause data loss.
+ // See http://www.propelorm.org/ticket/509
+ // $obj->hydrate($row, $startcol, true); // rehydrate
+ $col = $startcol + WerkzeugPeer::NUM_HYDRATE_COLUMNS;
+ } else {
+ $cls = WerkzeugPeer::OM_CLASS;
+ $obj = new $cls();
+ $col = $obj->hydrate($row, $startcol);
+ WerkzeugPeer::addInstanceToPool($obj, $key);
+ }
+
+ return array($obj, $col);
+ }
+
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(WerkzeugPeer::DATABASE_NAME)->getTable(WerkzeugPeer::TABLE_NAME);
+ }
+
+ /**
+ * Add a TableMap instance to the database for this peer class.
+ */
+ public static function buildTableMap()
+ {
+ $dbMap = Propel::getDatabaseMap(BaseWerkzeugPeer::DATABASE_NAME);
+ if (!$dbMap->hasTable(BaseWerkzeugPeer::TABLE_NAME)) {
+ $dbMap->addTableObject(new \WerkzeugTableMap());
+ }
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ *
+ * @return string ClassName
+ */
+ public static function getOMClass($row = 0, $colnum = 0)
+ {
+ return WerkzeugPeer::OM_CLASS;
+ }
+
+ /**
+ * Performs an INSERT on the database, given a Werkzeug or Criteria object.
+ *
+ * @param mixed $values Criteria or Werkzeug object containing data that is used to create the INSERT statement.
+ * @param PropelPDO $con the PropelPDO connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from Werkzeug object
+ }
+
+ if ($criteria->containsKey(WerkzeugPeer::ID) && $criteria->keyContainsValue(WerkzeugPeer::ID) ) {
+ throw new PropelException('Cannot insert a value for auto-increment primary key ('.WerkzeugPeer::ID.')');
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(WerkzeugPeer::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->beginTransaction();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Performs an UPDATE on the database, given a Werkzeug or Criteria object.
+ *
+ * @param mixed $values Criteria or Werkzeug object containing data that is used to create the UPDATE statement.
+ * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ $selectCriteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(WerkzeugPeer::ID);
+ $value = $criteria->remove(WerkzeugPeer::ID);
+ if ($value) {
+ $selectCriteria->add(WerkzeugPeer::ID, $value, $comparison);
+ } else {
+ $selectCriteria->setPrimaryTableName(WerkzeugPeer::TABLE_NAME);
+ }
+
+ } else { // $values is Werkzeug object
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(WerkzeugPeer::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Deletes all rows from the werkzeug table.
+ *
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException
+ */
+ public static function doDeleteAll(PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+ $affectedRows += BasePeer::doDeleteAll(WerkzeugPeer::TABLE_NAME, $con, WerkzeugPeer::DATABASE_NAME);
+ // Because this db requires some delete cascade/set null emulation, we have to
+ // clear the cached instance *after* the emulation has happened (since
+ // instances get re-added by the select statement contained therein).
+ WerkzeugPeer::clearInstancePool();
+ WerkzeugPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Performs a DELETE on the database, given a Werkzeug or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or Werkzeug object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param PropelPDO $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
+ }
+
+ if ($values instanceof Criteria) {
+ // invalidate the cache for all objects of this type, since we have no
+ // way of knowing (without running a query) what objects should be invalidated
+ // from the cache based on this Criteria.
+ WerkzeugPeer::clearInstancePool();
+ // rename for clarity
+ $criteria = clone $values;
+ } elseif ($values instanceof Werkzeug) { // it's a model object
+ // invalidate the cache for this single object
+ WerkzeugPeer::removeInstanceFromPool($values);
+ // create criteria based on pk values
+ $criteria = $values->buildPkeyCriteria();
+ } else { // it's a primary key, or an array of pks
+ $criteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
+ $criteria->add(WerkzeugPeer::ID, (array) $values, Criteria::IN);
+ // invalidate the cache for this object(s)
+ foreach ((array) $values as $singleval) {
+ WerkzeugPeer::removeInstanceFromPool($singleval);
+ }
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(WerkzeugPeer::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->beginTransaction();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ WerkzeugPeer::clearRelatedInstancePool();
+ $con->commit();
+
+ return $affectedRows;
+ } catch (Exception $e) {
+ $con->rollBack();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given Werkzeug object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param Werkzeug $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate($obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(WerkzeugPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(WerkzeugPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->hasColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(WerkzeugPeer::DATABASE_NAME, WerkzeugPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param int $pk the primary key.
+ * @param PropelPDO $con the connection to use
+ * @return Werkzeug
+ */
+ public static function retrieveByPK($pk, PropelPDO $con = null)
+ {
+
+ if (null !== ($obj = WerkzeugPeer::getInstanceFromPool((string) $pk))) {
+ return $obj;
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $criteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
+ $criteria->add(WerkzeugPeer::ID, $pk);
+
+ $v = WerkzeugPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param PropelPDO $con the connection to use
+ * @return Werkzeug[]
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, PropelPDO $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
+ $criteria->add(WerkzeugPeer::ID, $pks, Criteria::IN);
+ $objs = WerkzeugPeer::doSelect($criteria, $con);
+ }
+
+ return $objs;
+ }
+
+} // BaseWerkzeugPeer
+
+// This is the static code needed to register the TableMap for this table with the main Propel class.
+//
+BaseWerkzeugPeer::buildTableMap();
+
--- /dev/null
+<?php
+
+
+/**
+ * Base class that represents a query for the 'werkzeug' table.
+ *
+ *
+ *
+ * @method WerkzeugQuery orderById($order = Criteria::ASC) Order by the id column
+ * @method WerkzeugQuery orderByMod($order = Criteria::ASC) Order by the mod column
+ * @method WerkzeugQuery orderByTyp($order = Criteria::ASC) Order by the typ column
+ * @method WerkzeugQuery orderByBeschreibung($order = Criteria::ASC) Order by the beschreibung column
+ * @method WerkzeugQuery orderByEigentumer($order = Criteria::ASC) Order by the eigentumer column
+ * @method WerkzeugQuery orderByZzBei($order = Criteria::ASC) Order by the zz_bei column
+ *
+ * @method WerkzeugQuery groupById() Group by the id column
+ * @method WerkzeugQuery groupByMod() Group by the mod column
+ * @method WerkzeugQuery groupByTyp() Group by the typ column
+ * @method WerkzeugQuery groupByBeschreibung() Group by the beschreibung column
+ * @method WerkzeugQuery groupByEigentumer() Group by the eigentumer column
+ * @method WerkzeugQuery groupByZzBei() Group by the zz_bei column
+ *
+ * @method WerkzeugQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
+ * @method WerkzeugQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
+ * @method WerkzeugQuery innerJoin($relation) Adds a INNER JOIN clause to the query
+ *
+ * @method Werkzeug findOne(PropelPDO $con = null) Return the first Werkzeug matching the query
+ * @method Werkzeug findOneOrCreate(PropelPDO $con = null) Return the first Werkzeug matching the query, or a new Werkzeug object populated from the query conditions when no match is found
+ *
+ * @method Werkzeug findOneByMod(int $mod) Return the first Werkzeug filtered by the mod column
+ * @method Werkzeug findOneByTyp(string $typ) Return the first Werkzeug filtered by the typ column
+ * @method Werkzeug findOneByBeschreibung(string $beschreibung) Return the first Werkzeug filtered by the beschreibung column
+ * @method Werkzeug findOneByEigentumer(string $eigentumer) Return the first Werkzeug filtered by the eigentumer column
+ * @method Werkzeug findOneByZzBei(string $zz_bei) Return the first Werkzeug filtered by the zz_bei column
+ *
+ * @method array findById(int $id) Return Werkzeug objects filtered by the id column
+ * @method array findByMod(int $mod) Return Werkzeug objects filtered by the mod column
+ * @method array findByTyp(string $typ) Return Werkzeug objects filtered by the typ column
+ * @method array findByBeschreibung(string $beschreibung) Return Werkzeug objects filtered by the beschreibung column
+ * @method array findByEigentumer(string $eigentumer) Return Werkzeug objects filtered by the eigentumer column
+ * @method array findByZzBei(string $zz_bei) Return Werkzeug objects filtered by the zz_bei column
+ *
+ * @package propel.generator.propel.om
+ */
+abstract class BaseWerkzeugQuery extends ModelCriteria
+{
+ /**
+ * Initializes internal state of BaseWerkzeugQuery object.
+ *
+ * @param string $dbName The dabase name
+ * @param string $modelName The phpName of a model, e.g. 'Book'
+ * @param string $modelAlias The alias for the model in this query, e.g. 'b'
+ */
+ public function __construct($dbName = null, $modelName = null, $modelAlias = null)
+ {
+ if (null === $dbName) {
+ $dbName = 'mkrimi';
+ }
+ if (null === $modelName) {
+ $modelName = 'Werkzeug';
+ }
+ parent::__construct($dbName, $modelName, $modelAlias);
+ }
+
+ /**
+ * Returns a new WerkzeugQuery object.
+ *
+ * @param string $modelAlias The alias of a model in the query
+ * @param WerkzeugQuery|Criteria $criteria Optional Criteria to build the query from
+ *
+ * @return WerkzeugQuery
+ */
+ public static function create($modelAlias = null, $criteria = null)
+ {
+ if ($criteria instanceof WerkzeugQuery) {
+ return $criteria;
+ }
+ $query = new WerkzeugQuery(null, null, $modelAlias);
+
+ if ($criteria instanceof Criteria) {
+ $query->mergeWith($criteria);
+ }
+
+ return $query;
+ }
+
+ /**
+ * Find object by primary key.
+ * Propel uses the instance pool to skip the database if the object exists.
+ * Go fast if the query is untouched.
+ *
+ * <code>
+ * $obj = $c->findPk(12, $con);
+ * </code>
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return Werkzeug|Werkzeug[]|mixed the result, formatted by the current formatter
+ */
+ public function findPk($key, $con = null)
+ {
+ if ($key === null) {
+ return null;
+ }
+ if ((null !== ($obj = WerkzeugPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
+ // the object is already in the instance pool
+ return $obj;
+ }
+ if ($con === null) {
+ $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ if ($this->formatter || $this->modelAlias || $this->with || $this->select
+ || $this->selectColumns || $this->asColumns || $this->selectModifiers
+ || $this->map || $this->having || $this->joins) {
+ return $this->findPkComplex($key, $con);
+ } else {
+ return $this->findPkSimple($key, $con);
+ }
+ }
+
+ /**
+ * Alias of findPk to use instance pooling
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return Werkzeug A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ public function findOneById($key, $con = null)
+ {
+ return $this->findPk($key, $con);
+ }
+
+ /**
+ * Find object by primary key using raw SQL to go fast.
+ * Bypass doSelect() and the object formatter by using generated code.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return Werkzeug A model object, or null if the key is not found
+ * @throws PropelException
+ */
+ protected function findPkSimple($key, $con)
+ {
+ $sql = 'SELECT `id`, `mod`, `typ`, `beschreibung`, `eigentumer`, `zz_bei` FROM `werkzeug` WHERE `id` = :p0';
+ try {
+ $stmt = $con->prepare($sql);
+ $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
+ $stmt->execute();
+ } catch (Exception $e) {
+ Propel::log($e->getMessage(), Propel::LOG_ERR);
+ throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
+ }
+ $obj = null;
+ if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
+ $obj = new Werkzeug();
+ $obj->hydrate($row);
+ WerkzeugPeer::addInstanceToPool($obj, (string) $key);
+ }
+ $stmt->closeCursor();
+
+ return $obj;
+ }
+
+ /**
+ * Find object by primary key.
+ *
+ * @param mixed $key Primary key to use for the query
+ * @param PropelPDO $con A connection object
+ *
+ * @return Werkzeug|Werkzeug[]|mixed the result, formatted by the current formatter
+ */
+ protected function findPkComplex($key, $con)
+ {
+ // As the query uses a PK condition, no limit(1) is necessary.
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKey($key)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
+ }
+
+ /**
+ * Find objects by primary key
+ * <code>
+ * $objs = $c->findPks(array(12, 56, 832), $con);
+ * </code>
+ * @param array $keys Primary keys to use for the query
+ * @param PropelPDO $con an optional connection object
+ *
+ * @return PropelObjectCollection|Werkzeug[]|mixed the list of results, formatted by the current formatter
+ */
+ public function findPks($keys, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
+ }
+ $this->basePreSelect($con);
+ $criteria = $this->isKeepQuery() ? clone $this : $this;
+ $stmt = $criteria
+ ->filterByPrimaryKeys($keys)
+ ->doSelect($con);
+
+ return $criteria->getFormatter()->init($criteria)->format($stmt);
+ }
+
+ /**
+ * Filter the query by primary key
+ *
+ * @param mixed $key Primary key to use for the query
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKey($key)
+ {
+
+ return $this->addUsingAlias(WerkzeugPeer::ID, $key, Criteria::EQUAL);
+ }
+
+ /**
+ * Filter the query by a list of primary keys
+ *
+ * @param array $keys The list of primary key to use for the query
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterByPrimaryKeys($keys)
+ {
+
+ return $this->addUsingAlias(WerkzeugPeer::ID, $keys, Criteria::IN);
+ }
+
+ /**
+ * Filter the query on the id column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterById(1234); // WHERE id = 1234
+ * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
+ * $query->filterById(array('min' => 12)); // WHERE id >= 12
+ * $query->filterById(array('max' => 12)); // WHERE id <= 12
+ * </code>
+ *
+ * @param mixed $id The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterById($id = null, $comparison = null)
+ {
+ if (is_array($id)) {
+ $useMinMax = false;
+ if (isset($id['min'])) {
+ $this->addUsingAlias(WerkzeugPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($id['max'])) {
+ $this->addUsingAlias(WerkzeugPeer::ID, $id['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(WerkzeugPeer::ID, $id, $comparison);
+ }
+
+ /**
+ * Filter the query on the mod column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByMod(1234); // WHERE mod = 1234
+ * $query->filterByMod(array(12, 34)); // WHERE mod IN (12, 34)
+ * $query->filterByMod(array('min' => 12)); // WHERE mod >= 12
+ * $query->filterByMod(array('max' => 12)); // WHERE mod <= 12
+ * </code>
+ *
+ * @param mixed $mod The value to use as filter.
+ * Use scalar values for equality.
+ * Use array values for in_array() equivalent.
+ * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterByMod($mod = null, $comparison = null)
+ {
+ if (is_array($mod)) {
+ $useMinMax = false;
+ if (isset($mod['min'])) {
+ $this->addUsingAlias(WerkzeugPeer::MOD, $mod['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($mod['max'])) {
+ $this->addUsingAlias(WerkzeugPeer::MOD, $mod['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+
+ return $this->addUsingAlias(WerkzeugPeer::MOD, $mod, $comparison);
+ }
+
+ /**
+ * Filter the query on the typ column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByTyp('fooValue'); // WHERE typ = 'fooValue'
+ * $query->filterByTyp('%fooValue%'); // WHERE typ LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $typ The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterByTyp($typ = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($typ)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $typ)) {
+ $typ = str_replace('*', '%', $typ);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(WerkzeugPeer::TYP, $typ, $comparison);
+ }
+
+ /**
+ * Filter the query on the beschreibung column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByBeschreibung('fooValue'); // WHERE beschreibung = 'fooValue'
+ * $query->filterByBeschreibung('%fooValue%'); // WHERE beschreibung LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $beschreibung The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterByBeschreibung($beschreibung = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($beschreibung)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $beschreibung)) {
+ $beschreibung = str_replace('*', '%', $beschreibung);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(WerkzeugPeer::BESCHREIBUNG, $beschreibung, $comparison);
+ }
+
+ /**
+ * Filter the query on the eigentumer column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByEigentumer('fooValue'); // WHERE eigentumer = 'fooValue'
+ * $query->filterByEigentumer('%fooValue%'); // WHERE eigentumer LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $eigentumer The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterByEigentumer($eigentumer = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($eigentumer)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $eigentumer)) {
+ $eigentumer = str_replace('*', '%', $eigentumer);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(WerkzeugPeer::EIGENTUMER, $eigentumer, $comparison);
+ }
+
+ /**
+ * Filter the query on the zz_bei column
+ *
+ * Example usage:
+ * <code>
+ * $query->filterByZzBei('fooValue'); // WHERE zz_bei = 'fooValue'
+ * $query->filterByZzBei('%fooValue%'); // WHERE zz_bei LIKE '%fooValue%'
+ * </code>
+ *
+ * @param string $zzBei The value to use as filter.
+ * Accepts wildcards (* and % trigger a LIKE)
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function filterByZzBei($zzBei = null, $comparison = null)
+ {
+ if (null === $comparison) {
+ if (is_array($zzBei)) {
+ $comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $zzBei)) {
+ $zzBei = str_replace('*', '%', $zzBei);
+ $comparison = Criteria::LIKE;
+ }
+ }
+
+ return $this->addUsingAlias(WerkzeugPeer::ZZ_BEI, $zzBei, $comparison);
+ }
+
+ /**
+ * Exclude object from result
+ *
+ * @param Werkzeug $werkzeug Object to remove from the list of results
+ *
+ * @return WerkzeugQuery The current query, for fluid interface
+ */
+ public function prune($werkzeug = null)
+ {
+ if ($werkzeug) {
+ $this->addUsingAlias(WerkzeugPeer::ID, $werkzeug->getId(), Criteria::NOT_EQUAL);
+ }
+
+ return $this;
+ }
+
+}
--- /dev/null
+<?php
+// This file generated by Propel 1.7.2-dev convert-conf target
+return array (
+ 'BaseHorbuchQuery' => 'propel/om/BaseHorbuchQuery.php',
+ 'BaseKrimiQuery' => 'propel/om/BaseKrimiQuery.php',
+ 'BaseMedium' => 'propel/om/BaseMedium.php',
+ 'BaseMediumPeer' => 'propel/om/BaseMediumPeer.php',
+ 'BaseMediumQuery' => 'propel/om/BaseMediumQuery.php',
+ 'BaseRomanQuery' => 'propel/om/BaseRomanQuery.php',
+ 'BaseWerkzeug' => 'propel/om/BaseWerkzeug.php',
+ 'BaseWerkzeugPeer' => 'propel/om/BaseWerkzeugPeer.php',
+ 'BaseWerkzeugQuery' => 'propel/om/BaseWerkzeugQuery.php',
+ 'Horbuch' => 'propel/Horbuch.php',
+ 'HorbuchQuery' => 'propel/HorbuchQuery.php',
+ 'Krimi' => 'propel/Krimi.php',
+ 'KrimiQuery' => 'propel/KrimiQuery.php',
+ 'Medium' => 'propel/Medium.php',
+ 'MediumPeer' => 'propel/MediumPeer.php',
+ 'MediumQuery' => 'propel/MediumQuery.php',
+ 'MediumTableMap' => 'propel/map/MediumTableMap.php',
+ 'Roman' => 'propel/Roman.php',
+ 'RomanQuery' => 'propel/RomanQuery.php',
+ 'Werkzeug' => 'propel/Werkzeug.php',
+ 'WerkzeugPeer' => 'propel/WerkzeugPeer.php',
+ 'WerkzeugQuery' => 'propel/WerkzeugQuery.php',
+ 'WerkzeugTableMap' => 'propel/map/WerkzeugTableMap.php',
+);
\ No newline at end of file
--- /dev/null
+<?php
+// This file generated by Propel 1.7.2-dev convert-conf target
+// from XML runtime conf file /home/debian10/projects/verleihnix/Verleihnix/impl/data/runtime-conf.xml
+$conf = array (
+ 'datasources' =>
+ array (
+ 'mkrimi' =>
+ array (
+ 'adapter' => 'mysql',
+ 'connection' =>
+ array (
+ 'dsn' => 'mysql:host=localhost;dbname=mkrimi',
+ 'user' => 'mkrimi',
+ 'password' => 'mkrimi',
+ 'settings' =>
+ array (
+ 'charset' =>
+ array (
+ 'value' => 'utf8',
+ ),
+ ),
+ ),
+ ),
+ 'default' => 'mkrimi',
+ ),
+ 'generator_version' => '1.7.2-dev',
+);
+$conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-propel-conf.php');
+return $conf;
\ No newline at end of file
--- /dev/null
+mysql -umkrimi -pmkrimi mkrimi <schema.sql
--- /dev/null
+
+# This is a fix for InnoDB in MySQL >= 4.1.x
+# It "suspends judgement" for fkey relationships until are tables are set.
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ---------------------------------------------------------------------
+-- medium
+-- ---------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `medium`;
+
+CREATE TABLE `medium`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `mod` INTEGER NOT NULL,
+ `autor` VARCHAR(100) NOT NULL,
+ `titel` VARCHAR(100) NOT NULL,
+ `eigentumer` VARCHAR(100) NOT NULL,
+ `zz_bei` VARCHAR(100) NOT NULL,
+ `kommentar` VARCHAR(100) NOT NULL,
+ `class_key` INTEGER NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+
+-- ---------------------------------------------------------------------
+-- werkzeug
+-- ---------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `werkzeug`;
+
+CREATE TABLE `werkzeug`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `mod` INTEGER NOT NULL,
+ `typ` VARCHAR(100) NOT NULL,
+ `beschreibung` VARCHAR(100) NOT NULL,
+ `eigentumer` VARCHAR(100) NOT NULL,
+ `zz_bei` VARCHAR(100) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+
+# This restores the fkey checks, after having unset them earlier
+SET FOREIGN_KEY_CHECKS = 1;
--- /dev/null
+# Sqlfile -> Database map
+schema.sql=mkrimi