5 * Skeleton subclass for representing a query for one of the subclasses of the 'medium' table.
9 * You should add additional methods to this class to meet the
10 * application requirements. This class will only be generated as
11 * long as it does not already exist in the output directory.
13 * @package propel.generator.propel.om
15 class BaseKrimiQuery extends MediumQuery {
18 * Returns a new KrimiQuery object.
20 * @param string $modelAlias The alias of a model in the query
21 * @param Criteria $criteria Optional Criteria to build the query from
25 public static function create($modelAlias = null, $criteria = null)
27 if ($criteria instanceof KrimiQuery) {
30 $query = new KrimiQuery();
31 if (null !== $modelAlias) {
32 $query->setModelAlias($modelAlias);
34 if ($criteria instanceof Criteria) {
35 $query->mergeWith($criteria);
42 * Filters the query to target only Krimi objects.
44 public function preSelect(PropelPDO $con)
46 $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_1);
50 * Filters the query to target only Krimi objects.
52 public function preUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
54 $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_1);
58 * Filters the query to target only Krimi objects.
60 public function preDelete(PropelPDO $con)
62 $this->addUsingAlias(MediumPeer::CLASS_KEY, MediumPeer::CLASSKEY_1);
66 * Issue a DELETE query based on the current ModelCriteria deleting all rows in the table
67 * Having the Krimi class.
68 * This method is called by ModelCriteria::deleteAll() inside a transaction
70 * @param PropelPDO $con a connection object
72 * @return integer the number of deleted rows
74 public function doDeleteAll($con)
76 // condition on class key is already added in preDelete()
77 return parent::doDelete($con);
82 * Issue a SELECT ... LIMIT 1 query based on the current ModelCriteria
83 * and format the result with the current formatter
84 * By default, returns a model object
86 * @param PropelPDO $con an optional connection object
88 * @return mixed the result, formatted by the current formatter
90 * @throws PropelException
92 public function findOneOrCreate($con = null)
95 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.');
97 if (!$ret = $this->findOne($con)) {
98 $class = MediumPeer::CLASSNAME_1;
100 foreach ($this->keys() as $key) {
101 $obj->setByName($key, $this->getValue($key), BasePeer::TYPE_COLNAME);
103 $ret = $this->getFormatter()->formatRecord($obj);