5 * Base class that represents a query for the 'medium' table.
9 * @method MediumQuery orderById($order = Criteria::ASC) Order by the id column
10 * @method MediumQuery orderByMod($order = Criteria::ASC) Order by the mod column
11 * @method MediumQuery orderByAutor($order = Criteria::ASC) Order by the autor column
12 * @method MediumQuery orderByTitel($order = Criteria::ASC) Order by the titel column
13 * @method MediumQuery orderByEigentumer($order = Criteria::ASC) Order by the eigentumer column
14 * @method MediumQuery orderByZzBei($order = Criteria::ASC) Order by the zz_bei column
15 * @method MediumQuery orderByKommentar($order = Criteria::ASC) Order by the kommentar column
16 * @method MediumQuery orderByClassKey($order = Criteria::ASC) Order by the class_key column
18 * @method MediumQuery groupById() Group by the id column
19 * @method MediumQuery groupByMod() Group by the mod column
20 * @method MediumQuery groupByAutor() Group by the autor column
21 * @method MediumQuery groupByTitel() Group by the titel column
22 * @method MediumQuery groupByEigentumer() Group by the eigentumer column
23 * @method MediumQuery groupByZzBei() Group by the zz_bei column
24 * @method MediumQuery groupByKommentar() Group by the kommentar column
25 * @method MediumQuery groupByClassKey() Group by the class_key column
27 * @method MediumQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
28 * @method MediumQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
29 * @method MediumQuery innerJoin($relation) Adds a INNER JOIN clause to the query
31 * @method Medium findOne(PropelPDO $con = null) Return the first Medium matching the query
32 * @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
34 * @method Medium findOneByMod(int $mod) Return the first Medium filtered by the mod column
35 * @method Medium findOneByAutor(string $autor) Return the first Medium filtered by the autor column
36 * @method Medium findOneByTitel(string $titel) Return the first Medium filtered by the titel column
37 * @method Medium findOneByEigentumer(string $eigentumer) Return the first Medium filtered by the eigentumer column
38 * @method Medium findOneByZzBei(string $zz_bei) Return the first Medium filtered by the zz_bei column
39 * @method Medium findOneByKommentar(string $kommentar) Return the first Medium filtered by the kommentar column
40 * @method Medium findOneByClassKey(int $class_key) Return the first Medium filtered by the class_key column
42 * @method array findById(int $id) Return Medium objects filtered by the id column
43 * @method array findByMod(int $mod) Return Medium objects filtered by the mod column
44 * @method array findByAutor(string $autor) Return Medium objects filtered by the autor column
45 * @method array findByTitel(string $titel) Return Medium objects filtered by the titel column
46 * @method array findByEigentumer(string $eigentumer) Return Medium objects filtered by the eigentumer column
47 * @method array findByZzBei(string $zz_bei) Return Medium objects filtered by the zz_bei column
48 * @method array findByKommentar(string $kommentar) Return Medium objects filtered by the kommentar column
49 * @method array findByClassKey(int $class_key) Return Medium objects filtered by the class_key column
51 * @package propel.generator.propel.om
53 abstract class BaseMediumQuery extends ModelCriteria
56 * Initializes internal state of BaseMediumQuery object.
58 * @param string $dbName The dabase name
59 * @param string $modelName The phpName of a model, e.g. 'Book'
60 * @param string $modelAlias The alias for the model in this query, e.g. 'b'
62 public function __construct($dbName = null, $modelName = null, $modelAlias = null)
64 if (null === $dbName) {
67 if (null === $modelName) {
68 $modelName = 'Medium';
70 parent::__construct($dbName, $modelName, $modelAlias);
74 * Returns a new MediumQuery object.
76 * @param string $modelAlias The alias of a model in the query
77 * @param MediumQuery|Criteria $criteria Optional Criteria to build the query from
81 public static function create($modelAlias = null, $criteria = null)
83 if ($criteria instanceof MediumQuery) {
86 $query = new MediumQuery(null, null, $modelAlias);
88 if ($criteria instanceof Criteria) {
89 $query->mergeWith($criteria);
96 * Find object by primary key.
97 * Propel uses the instance pool to skip the database if the object exists.
98 * Go fast if the query is untouched.
101 * $obj = $c->findPk(12, $con);
104 * @param mixed $key Primary key to use for the query
105 * @param PropelPDO $con an optional connection object
107 * @return Medium|Medium[]|mixed the result, formatted by the current formatter
109 public function findPk($key, $con = null)
114 if ((null !== ($obj = MediumPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
115 // the object is already in the instance pool
119 $con = Propel::getConnection(MediumPeer::DATABASE_NAME, Propel::CONNECTION_READ);
121 $this->basePreSelect($con);
122 if ($this->formatter || $this->modelAlias || $this->with || $this->select
123 || $this->selectColumns || $this->asColumns || $this->selectModifiers
124 || $this->map || $this->having || $this->joins) {
125 return $this->findPkComplex($key, $con);
127 return $this->findPkSimple($key, $con);
132 * Alias of findPk to use instance pooling
134 * @param mixed $key Primary key to use for the query
135 * @param PropelPDO $con A connection object
137 * @return Medium A model object, or null if the key is not found
138 * @throws PropelException
140 public function findOneById($key, $con = null)
142 return $this->findPk($key, $con);
146 * Find object by primary key using raw SQL to go fast.
147 * Bypass doSelect() and the object formatter by using generated code.
149 * @param mixed $key Primary key to use for the query
150 * @param PropelPDO $con A connection object
152 * @return Medium A model object, or null if the key is not found
153 * @throws PropelException
155 protected function findPkSimple($key, $con)
157 $sql = 'SELECT `id`, `mod`, `autor`, `titel`, `eigentumer`, `zz_bei`, `kommentar`, `class_key` FROM `medium` WHERE `id` = :p0';
159 $stmt = $con->prepare($sql);
160 $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
162 } catch (Exception $e) {
163 Propel::log($e->getMessage(), Propel::LOG_ERR);
164 throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
167 if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
168 $cls = MediumPeer::getOMClass($row, 0);
171 MediumPeer::addInstanceToPool($obj, (string) $key);
173 $stmt->closeCursor();
179 * Find object by primary key.
181 * @param mixed $key Primary key to use for the query
182 * @param PropelPDO $con A connection object
184 * @return Medium|Medium[]|mixed the result, formatted by the current formatter
186 protected function findPkComplex($key, $con)
188 // As the query uses a PK condition, no limit(1) is necessary.
189 $criteria = $this->isKeepQuery() ? clone $this : $this;
191 ->filterByPrimaryKey($key)
194 return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
198 * Find objects by primary key
200 * $objs = $c->findPks(array(12, 56, 832), $con);
202 * @param array $keys Primary keys to use for the query
203 * @param PropelPDO $con an optional connection object
205 * @return PropelObjectCollection|Medium[]|mixed the list of results, formatted by the current formatter
207 public function findPks($keys, $con = null)
210 $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
212 $this->basePreSelect($con);
213 $criteria = $this->isKeepQuery() ? clone $this : $this;
215 ->filterByPrimaryKeys($keys)
218 return $criteria->getFormatter()->init($criteria)->format($stmt);
222 * Filter the query by primary key
224 * @param mixed $key Primary key to use for the query
226 * @return MediumQuery The current query, for fluid interface
228 public function filterByPrimaryKey($key)
231 return $this->addUsingAlias(MediumPeer::ID, $key, Criteria::EQUAL);
235 * Filter the query by a list of primary keys
237 * @param array $keys The list of primary key to use for the query
239 * @return MediumQuery The current query, for fluid interface
241 public function filterByPrimaryKeys($keys)
244 return $this->addUsingAlias(MediumPeer::ID, $keys, Criteria::IN);
248 * Filter the query on the id column
252 * $query->filterById(1234); // WHERE id = 1234
253 * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
254 * $query->filterById(array('min' => 12)); // WHERE id >= 12
255 * $query->filterById(array('max' => 12)); // WHERE id <= 12
258 * @param mixed $id The value to use as filter.
259 * Use scalar values for equality.
260 * Use array values for in_array() equivalent.
261 * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
262 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
264 * @return MediumQuery The current query, for fluid interface
266 public function filterById($id = null, $comparison = null)
270 if (isset($id['min'])) {
271 $this->addUsingAlias(MediumPeer::ID, $id['min'], Criteria::GREATER_EQUAL);
274 if (isset($id['max'])) {
275 $this->addUsingAlias(MediumPeer::ID, $id['max'], Criteria::LESS_EQUAL);
281 if (null === $comparison) {
282 $comparison = Criteria::IN;
286 return $this->addUsingAlias(MediumPeer::ID, $id, $comparison);
290 * Filter the query on the mod column
294 * $query->filterByMod(1234); // WHERE mod = 1234
295 * $query->filterByMod(array(12, 34)); // WHERE mod IN (12, 34)
296 * $query->filterByMod(array('min' => 12)); // WHERE mod >= 12
297 * $query->filterByMod(array('max' => 12)); // WHERE mod <= 12
300 * @param mixed $mod The value to use as filter.
301 * Use scalar values for equality.
302 * Use array values for in_array() equivalent.
303 * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
304 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
306 * @return MediumQuery The current query, for fluid interface
308 public function filterByMod($mod = null, $comparison = null)
310 if (is_array($mod)) {
312 if (isset($mod['min'])) {
313 $this->addUsingAlias(MediumPeer::MOD, $mod['min'], Criteria::GREATER_EQUAL);
316 if (isset($mod['max'])) {
317 $this->addUsingAlias(MediumPeer::MOD, $mod['max'], Criteria::LESS_EQUAL);
323 if (null === $comparison) {
324 $comparison = Criteria::IN;
328 return $this->addUsingAlias(MediumPeer::MOD, $mod, $comparison);
332 * Filter the query on the autor column
336 * $query->filterByAutor('fooValue'); // WHERE autor = 'fooValue'
337 * $query->filterByAutor('%fooValue%'); // WHERE autor LIKE '%fooValue%'
340 * @param string $autor The value to use as filter.
341 * Accepts wildcards (* and % trigger a LIKE)
342 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
344 * @return MediumQuery The current query, for fluid interface
346 public function filterByAutor($autor = null, $comparison = null)
348 if (null === $comparison) {
349 if (is_array($autor)) {
350 $comparison = Criteria::IN;
351 } elseif (preg_match('/[\%\*]/', $autor)) {
352 $autor = str_replace('*', '%', $autor);
353 $comparison = Criteria::LIKE;
357 return $this->addUsingAlias(MediumPeer::AUTOR, $autor, $comparison);
361 * Filter the query on the titel column
365 * $query->filterByTitel('fooValue'); // WHERE titel = 'fooValue'
366 * $query->filterByTitel('%fooValue%'); // WHERE titel LIKE '%fooValue%'
369 * @param string $titel The value to use as filter.
370 * Accepts wildcards (* and % trigger a LIKE)
371 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
373 * @return MediumQuery The current query, for fluid interface
375 public function filterByTitel($titel = null, $comparison = null)
377 if (null === $comparison) {
378 if (is_array($titel)) {
379 $comparison = Criteria::IN;
380 } elseif (preg_match('/[\%\*]/', $titel)) {
381 $titel = str_replace('*', '%', $titel);
382 $comparison = Criteria::LIKE;
386 return $this->addUsingAlias(MediumPeer::TITEL, $titel, $comparison);
390 * Filter the query on the eigentumer column
394 * $query->filterByEigentumer('fooValue'); // WHERE eigentumer = 'fooValue'
395 * $query->filterByEigentumer('%fooValue%'); // WHERE eigentumer LIKE '%fooValue%'
398 * @param string $eigentumer The value to use as filter.
399 * Accepts wildcards (* and % trigger a LIKE)
400 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
402 * @return MediumQuery The current query, for fluid interface
404 public function filterByEigentumer($eigentumer = null, $comparison = null)
406 if (null === $comparison) {
407 if (is_array($eigentumer)) {
408 $comparison = Criteria::IN;
409 } elseif (preg_match('/[\%\*]/', $eigentumer)) {
410 $eigentumer = str_replace('*', '%', $eigentumer);
411 $comparison = Criteria::LIKE;
415 return $this->addUsingAlias(MediumPeer::EIGENTUMER, $eigentumer, $comparison);
419 * Filter the query on the zz_bei column
423 * $query->filterByZzBei('fooValue'); // WHERE zz_bei = 'fooValue'
424 * $query->filterByZzBei('%fooValue%'); // WHERE zz_bei LIKE '%fooValue%'
427 * @param string $zzBei The value to use as filter.
428 * Accepts wildcards (* and % trigger a LIKE)
429 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
431 * @return MediumQuery The current query, for fluid interface
433 public function filterByZzBei($zzBei = null, $comparison = null)
435 if (null === $comparison) {
436 if (is_array($zzBei)) {
437 $comparison = Criteria::IN;
438 } elseif (preg_match('/[\%\*]/', $zzBei)) {
439 $zzBei = str_replace('*', '%', $zzBei);
440 $comparison = Criteria::LIKE;
444 return $this->addUsingAlias(MediumPeer::ZZ_BEI, $zzBei, $comparison);
448 * Filter the query on the kommentar column
452 * $query->filterByKommentar('fooValue'); // WHERE kommentar = 'fooValue'
453 * $query->filterByKommentar('%fooValue%'); // WHERE kommentar LIKE '%fooValue%'
456 * @param string $kommentar The value to use as filter.
457 * Accepts wildcards (* and % trigger a LIKE)
458 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
460 * @return MediumQuery The current query, for fluid interface
462 public function filterByKommentar($kommentar = null, $comparison = null)
464 if (null === $comparison) {
465 if (is_array($kommentar)) {
466 $comparison = Criteria::IN;
467 } elseif (preg_match('/[\%\*]/', $kommentar)) {
468 $kommentar = str_replace('*', '%', $kommentar);
469 $comparison = Criteria::LIKE;
473 return $this->addUsingAlias(MediumPeer::KOMMENTAR, $kommentar, $comparison);
477 * Filter the query on the class_key column
481 * $query->filterByClassKey(1234); // WHERE class_key = 1234
482 * $query->filterByClassKey(array(12, 34)); // WHERE class_key IN (12, 34)
483 * $query->filterByClassKey(array('min' => 12)); // WHERE class_key >= 12
484 * $query->filterByClassKey(array('max' => 12)); // WHERE class_key <= 12
487 * @param mixed $classKey The value to use as filter.
488 * Use scalar values for equality.
489 * Use array values for in_array() equivalent.
490 * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
491 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
493 * @return MediumQuery The current query, for fluid interface
495 public function filterByClassKey($classKey = null, $comparison = null)
497 if (is_array($classKey)) {
499 if (isset($classKey['min'])) {
500 $this->addUsingAlias(MediumPeer::CLASS_KEY, $classKey['min'], Criteria::GREATER_EQUAL);
503 if (isset($classKey['max'])) {
504 $this->addUsingAlias(MediumPeer::CLASS_KEY, $classKey['max'], Criteria::LESS_EQUAL);
510 if (null === $comparison) {
511 $comparison = Criteria::IN;
515 return $this->addUsingAlias(MediumPeer::CLASS_KEY, $classKey, $comparison);
519 * Exclude object from result
521 * @param Medium $medium Object to remove from the list of results
523 * @return MediumQuery The current query, for fluid interface
525 public function prune($medium = null)
528 $this->addUsingAlias(MediumPeer::ID, $medium->getId(), Criteria::NOT_EQUAL);