From 2b057472cae9bd9d1a06402b3ef7cf8f8aa589ce Mon Sep 17 00:00:00 2001 From: Robbt Date: Sun, 20 Jan 2019 02:12:21 +0000 Subject: [PATCH] part of the way there towards grouping need to deal with OR value --- .gitignore | 1 + .../airtime_3.0.0-alpha.8/downgrade.sql | 1 + .../airtime_3.0.0-alpha.8/upgrade.sql | 1 + airtime_mvc/application/models/Block.php | 39 ++++++----- .../airtime/map/CcBlockcriteriaTableMap.php | 1 + .../models/airtime/om/BaseCcBlock.php | 6 +- .../models/airtime/om/BaseCcBlockcontents.php | 6 +- .../models/airtime/om/BaseCcBlockcriteria.php | 64 +++++++++++++++++-- .../airtime/om/BaseCcBlockcriteriaPeer.php | 33 ++++++---- .../airtime/om/BaseCcBlockcriteriaQuery.php | 48 +++++++++++++- .../airtime/om/BaseCcPlaylistcontents.php | 6 +- airtime_mvc/build/schema.xml | 1 + airtime_mvc/build/sql/schema.sql | 3 +- 13 files changed, 166 insertions(+), 44 deletions(-) create mode 100644 airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.8/downgrade.sql create mode 100644 airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.8/upgrade.sql diff --git a/.gitignore b/.gitignore index 7e6412ac8..719207802 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ VERSION airtime_mvc/tests/log/*.log .vagrant/ .DS_Store +.idea/ diff --git a/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.8/downgrade.sql b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.8/downgrade.sql new file mode 100644 index 000000000..593b8c821 --- /dev/null +++ b/airtime_mvc/application/controllers/downgrade_sql/airtime_3.0.0-alpha.8/downgrade.sql @@ -0,0 +1 @@ +ALTER TABLE cc_blockcriteria DROP COLUMN IF EXISTS criteriagroup; \ No newline at end of file diff --git a/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.8/upgrade.sql b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.8/upgrade.sql new file mode 100644 index 000000000..a274478bf --- /dev/null +++ b/airtime_mvc/application/controllers/upgrade_sql/airtime_3.0.0-alpha.8/upgrade.sql @@ -0,0 +1 @@ +ALTER TABLE cc_blockcriteria ADD COLUMN criteriagroup integer; diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index db64a0514..528cab82d 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -1198,6 +1198,9 @@ SQL; if (isset($p_criteriaData['criteria'])) { $critKeys = array_keys($p_criteriaData['criteria']); for ($i = 0; $i < count($critKeys); $i++) { + // in order to maintain separation of different criteria to preserve AND statements for criteria + // that might contradict itself we group them based upon their original position on the form + $criteriaGroup = $i; foreach ($p_criteriaData['criteria'][$critKeys[$i]] as $d) { Logging::info($d); $field = $d['sp_criteria_field']; @@ -1242,8 +1245,10 @@ SQL; $qry->setDbExtra($extra); } - if (isset($extra)) { - $qry->setDbExtra($extra); + // save the criteria group so separation via new modifiers AND can be preserved vs. lumping + // them all into a single or later on + if (isset($criteriaGroup)) { + $qry->setDbCriteriaGroup($criteriaGroup); } $qry->save(); } @@ -1488,6 +1493,7 @@ SQL; $modifier = $crit->getDbModifier(); $value = $crit->getDbValue(); $extra = $crit->getDbExtra(); + $criteriagroup = $crit->getDbCriteriaGroup(); if ($criteria == "limit") { $storedCrit["limit"] = array( @@ -1506,6 +1512,7 @@ SQL; "value"=>$value, "modifier"=>$modifier, "extra"=>$extra, + "criteria_group"=>$criteriagroup, "display_name"=>$criteriaOptions[$criteria], "display_modifier"=>$modifierOptions[$modifier]); } @@ -1523,18 +1530,19 @@ SQL; $qry = CcFilesQuery::create(); $qry->useFkOwnerQuery("subj", "left join"); + //Logging::info($storedCrit); if (isset($storedCrit["crit"])) { foreach ($storedCrit["crit"] as $crit) { $i = 0; $prevgroup = null; $group = null; - Logging::info($crit); // now we need to sort based upon extra which contains the and grouping from the form usort($crit, function($a, $b) { - return $a['extra'] - $b['extra']; + return $a['criteria_group'] - $b['criteria_group']; }); - Logging::info($crit); + // we need to run the following loop separately for each criteria group inside of each array foreach ($crit as $criteria) { + $group = $criteria['criteria_group']; $spCriteria = $criteria['criteria']; $spCriteriaModifier = $criteria['modifier']; @@ -1578,7 +1586,6 @@ SQL; $spCriteriaValue = ($criteria['value']); } $spCriteriaExtra = $criteria['extra']; - $group = $criteria['extra']; } if ($spCriteriaModifier == "starts with") { @@ -1612,26 +1619,28 @@ SQL; // Logging::info($tdt); $spCriteriaValue = "$spCriteria >= '$fdt' AND $spCriteria <= '$tdt'"; } - logging::info('before'); - logging::info($spCriteriaModifier); + // logging::info('before'); + // logging::info($spCriteriaModifier); $spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier]; - logging::info('after'); - logging::info($spCriteriaModifier); + // logging::info('after'); + // logging::info($spCriteriaModifier); try { if ($spCriteria == "owner_id") { $spCriteria = "subj.login"; } - if ($i > 0 && $group == $prevgroup) { + Logging::info($i); + Logging::info($group); + Logging::info($prevgroup); + if ($i > 0 && $prevgroup == $group) { + Logging::info('adding or'); $qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier); - Logging::info('it happened'); } else { - Logging::info('it didnt happen'); - $qry->add($spCriteria, $spCriteriaValue, $spCriteriaModifier); + Logging::info('adding and'); + $qry->addAnd($spCriteria, $spCriteriaValue, $spCriteriaModifier); } - if ($spCriteriaModifier == Criteria::NOT_ILIKE || $spCriteriaModifier == Criteria::NOT_EQUAL) { $qry->addOr($spCriteria, null, Criteria::ISNULL); } diff --git a/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php b/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php index cf4a5e2ec..adf31fa13 100644 --- a/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcBlockcriteriaTableMap.php @@ -44,6 +44,7 @@ class CcBlockcriteriaTableMap extends TableMap $this->addColumn('modifier', 'DbModifier', 'VARCHAR', true, 16, null); $this->addColumn('value', 'DbValue', 'VARCHAR', true, 512, null); $this->addColumn('extra', 'DbExtra', 'VARCHAR', false, 512, null); + $this->addColumn('criteriagroup', 'DbCriteriaGroup', 'INTEGER', false, null, null); $this->addForeignKey('block_id', 'DbBlockId', 'INTEGER', 'cc_block', 'id', true, null, null); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlock.php b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php index f5d0ad630..236d3542d 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlock.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlock.php @@ -75,7 +75,7 @@ abstract class BaseCcBlock extends BaseObject implements Persistent /** * The value for the type field. - * Note: this column has a database default value of: 'dynamic' + * Note: this column has a database default value of: 'static' * @var string */ protected $type; @@ -151,7 +151,7 @@ abstract class BaseCcBlock extends BaseObject implements Persistent { $this->name = ''; $this->length = '00:00:00'; - $this->type = 'dynamic'; + $this->type = 'static'; } /** @@ -494,7 +494,7 @@ abstract class BaseCcBlock extends BaseObject implements Persistent return false; } - if ($this->type !== 'dynamic') { + if ($this->type !== 'static') { return false; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php index ec32bc9c8..0729979ab 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcontents.php @@ -55,7 +55,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent /** * The value for the trackoffset field. - * Note: this column has a database default value of: 0 + * Note: this column has a database default value of: 0.0 * @var double */ protected $trackoffset; @@ -136,7 +136,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent */ public function applyDefaultValues() { - $this->trackoffset = 0; + $this->trackoffset = 0.0; $this->cliplength = '00:00:00'; $this->cuein = '00:00:00'; $this->cueout = '00:00:00'; @@ -548,7 +548,7 @@ abstract class BaseCcBlockcontents extends BaseObject implements Persistent */ public function hasOnlyDefaultValues() { - if ($this->trackoffset !== 0) { + if ($this->trackoffset !== 0.0) { return false; } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php index 069a8f96e..a1b663a73 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteria.php @@ -59,6 +59,12 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent */ protected $extra; + /** + * The value for the criteriagroup field. + * @var int + */ + protected $criteriagroup; + /** * The value for the block_id field. * @var int @@ -145,6 +151,17 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent return $this->extra; } + /** + * Get the [criteriagroup] column value. + * + * @return int + */ + public function getDbCriteriaGroup() + { + + return $this->criteriagroup; + } + /** * Get the [block_id] column value. * @@ -261,6 +278,27 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent return $this; } // setDbExtra() + /** + * Set the value of [criteriagroup] column. + * + * @param int $v new value + * @return CcBlockcriteria The current object (for fluent API support) + */ + public function setDbCriteriaGroup($v) + { + if ($v !== null && is_numeric($v)) { + $v = (int) $v; + } + + if ($this->criteriagroup !== $v) { + $this->criteriagroup = $v; + $this->modifiedColumns[] = CcBlockcriteriaPeer::CRITERIAGROUP; + } + + + return $this; + } // setDbCriteriaGroup() + /** * Set the value of [block_id] column. * @@ -323,7 +361,8 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent $this->modifier = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->value = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->extra = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; - $this->block_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->criteriagroup = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; + $this->block_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null; $this->resetModified(); $this->setNew(false); @@ -333,7 +372,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent } $this->postHydrate($row, $startcol, $rehydrate); - return $startcol + 6; // 6 = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS. + return $startcol + 7; // 7 = CcBlockcriteriaPeer::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating CcBlockcriteria object", $e); @@ -586,6 +625,9 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent if ($this->isColumnModified(CcBlockcriteriaPeer::EXTRA)) { $modifiedColumns[':p' . $index++] = '"extra"'; } + if ($this->isColumnModified(CcBlockcriteriaPeer::CRITERIAGROUP)) { + $modifiedColumns[':p' . $index++] = '"criteriagroup"'; + } if ($this->isColumnModified(CcBlockcriteriaPeer::BLOCK_ID)) { $modifiedColumns[':p' . $index++] = '"block_id"'; } @@ -615,6 +657,9 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent case '"extra"': $stmt->bindValue($identifier, $this->extra, PDO::PARAM_STR); break; + case '"criteriagroup"': + $stmt->bindValue($identifier, $this->criteriagroup, PDO::PARAM_INT); + break; case '"block_id"': $stmt->bindValue($identifier, $this->block_id, PDO::PARAM_INT); break; @@ -773,6 +818,9 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent return $this->getDbExtra(); break; case 5: + return $this->getDbCriteriaGroup(); + break; + case 6: return $this->getDbBlockId(); break; default: @@ -809,7 +857,8 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent $keys[2] => $this->getDbModifier(), $keys[3] => $this->getDbValue(), $keys[4] => $this->getDbExtra(), - $keys[5] => $this->getDbBlockId(), + $keys[5] => $this->getDbCriteriaGroup(), + $keys[6] => $this->getDbBlockId(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -870,6 +919,9 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent $this->setDbExtra($value); break; case 5: + $this->setDbCriteriaGroup($value); + break; + case 6: $this->setDbBlockId($value); break; } // switch() @@ -901,7 +953,8 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent if (array_key_exists($keys[2], $arr)) $this->setDbModifier($arr[$keys[2]]); if (array_key_exists($keys[3], $arr)) $this->setDbValue($arr[$keys[3]]); if (array_key_exists($keys[4], $arr)) $this->setDbExtra($arr[$keys[4]]); - if (array_key_exists($keys[5], $arr)) $this->setDbBlockId($arr[$keys[5]]); + if (array_key_exists($keys[5], $arr)) $this->setDbCriteriaGroup($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setDbBlockId($arr[$keys[6]]); } /** @@ -918,6 +971,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent if ($this->isColumnModified(CcBlockcriteriaPeer::MODIFIER)) $criteria->add(CcBlockcriteriaPeer::MODIFIER, $this->modifier); if ($this->isColumnModified(CcBlockcriteriaPeer::VALUE)) $criteria->add(CcBlockcriteriaPeer::VALUE, $this->value); if ($this->isColumnModified(CcBlockcriteriaPeer::EXTRA)) $criteria->add(CcBlockcriteriaPeer::EXTRA, $this->extra); + if ($this->isColumnModified(CcBlockcriteriaPeer::CRITERIAGROUP)) $criteria->add(CcBlockcriteriaPeer::CRITERIAGROUP, $this->criteriagroup); if ($this->isColumnModified(CcBlockcriteriaPeer::BLOCK_ID)) $criteria->add(CcBlockcriteriaPeer::BLOCK_ID, $this->block_id); return $criteria; @@ -986,6 +1040,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent $copyObj->setDbModifier($this->getDbModifier()); $copyObj->setDbValue($this->getDbValue()); $copyObj->setDbExtra($this->getDbExtra()); + $copyObj->setDbCriteriaGroup($this->getDbCriteriaGroup()); $copyObj->setDbBlockId($this->getDbBlockId()); if ($deepCopy && !$this->startCopy) { @@ -1107,6 +1162,7 @@ abstract class BaseCcBlockcriteria extends BaseObject implements Persistent $this->modifier = null; $this->value = null; $this->extra = null; + $this->criteriagroup = null; $this->block_id = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php index 00024dfa6..27dd9ac29 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaPeer.php @@ -24,13 +24,13 @@ abstract class BaseCcBlockcriteriaPeer const TM_CLASS = 'CcBlockcriteriaTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 6; + const NUM_COLUMNS = 7; /** 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; + const NUM_HYDRATE_COLUMNS = 7; /** the column name for the id field */ const ID = 'cc_blockcriteria.id'; @@ -47,6 +47,9 @@ abstract class BaseCcBlockcriteriaPeer /** the column name for the extra field */ const EXTRA = 'cc_blockcriteria.extra'; + /** the column name for the criteriagroup field */ + const CRITERIAGROUP = 'cc_blockcriteria.criteriagroup'; + /** the column name for the block_id field */ const BLOCK_ID = 'cc_blockcriteria.block_id'; @@ -69,12 +72,12 @@ abstract class BaseCcBlockcriteriaPeer * e.g. CcBlockcriteriaPeer::$fieldNames[CcBlockcriteriaPeer::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbBlockId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbBlockId', ), - BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID, CcBlockcriteriaPeer::CRITERIA, CcBlockcriteriaPeer::MODIFIER, CcBlockcriteriaPeer::VALUE, CcBlockcriteriaPeer::EXTRA, CcBlockcriteriaPeer::BLOCK_ID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'BLOCK_ID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'block_id', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbCriteria', 'DbModifier', 'DbValue', 'DbExtra', 'DbCriteriaGroup', 'DbBlockId', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbCriteria', 'dbModifier', 'dbValue', 'dbExtra', 'dbCriteriaGroup', 'dbBlockId', ), + BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID, CcBlockcriteriaPeer::CRITERIA, CcBlockcriteriaPeer::MODIFIER, CcBlockcriteriaPeer::VALUE, CcBlockcriteriaPeer::EXTRA, CcBlockcriteriaPeer::CRITERIAGROUP, CcBlockcriteriaPeer::BLOCK_ID, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CRITERIA', 'MODIFIER', 'VALUE', 'EXTRA', 'CRITERIAGROUP', 'BLOCK_ID', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'criteria', 'modifier', 'value', 'extra', 'criteriagroup', 'block_id', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); /** @@ -84,12 +87,12 @@ abstract class BaseCcBlockcriteriaPeer * e.g. CcBlockcriteriaPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbBlockId' => 5, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbBlockId' => 5, ), - BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID => 0, CcBlockcriteriaPeer::CRITERIA => 1, CcBlockcriteriaPeer::MODIFIER => 2, CcBlockcriteriaPeer::VALUE => 3, CcBlockcriteriaPeer::EXTRA => 4, CcBlockcriteriaPeer::BLOCK_ID => 5, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'BLOCK_ID' => 5, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'block_id' => 5, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbCriteria' => 1, 'DbModifier' => 2, 'DbValue' => 3, 'DbExtra' => 4, 'DbCriteriaGroup' => 5, 'DbBlockId' => 6, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbCriteria' => 1, 'dbModifier' => 2, 'dbValue' => 3, 'dbExtra' => 4, 'dbCriteriaGroup' => 5, 'dbBlockId' => 6, ), + BasePeer::TYPE_COLNAME => array (CcBlockcriteriaPeer::ID => 0, CcBlockcriteriaPeer::CRITERIA => 1, CcBlockcriteriaPeer::MODIFIER => 2, CcBlockcriteriaPeer::VALUE => 3, CcBlockcriteriaPeer::EXTRA => 4, CcBlockcriteriaPeer::CRITERIAGROUP => 5, CcBlockcriteriaPeer::BLOCK_ID => 6, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CRITERIA' => 1, 'MODIFIER' => 2, 'VALUE' => 3, 'EXTRA' => 4, 'CRITERIAGROUP' => 5, 'BLOCK_ID' => 6, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'criteria' => 1, 'modifier' => 2, 'value' => 3, 'extra' => 4, 'criteriagroup' => 5, 'block_id' => 6, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) ); /** @@ -168,6 +171,7 @@ abstract class BaseCcBlockcriteriaPeer $criteria->addSelectColumn(CcBlockcriteriaPeer::MODIFIER); $criteria->addSelectColumn(CcBlockcriteriaPeer::VALUE); $criteria->addSelectColumn(CcBlockcriteriaPeer::EXTRA); + $criteria->addSelectColumn(CcBlockcriteriaPeer::CRITERIAGROUP); $criteria->addSelectColumn(CcBlockcriteriaPeer::BLOCK_ID); } else { $criteria->addSelectColumn($alias . '.id'); @@ -175,6 +179,7 @@ abstract class BaseCcBlockcriteriaPeer $criteria->addSelectColumn($alias . '.modifier'); $criteria->addSelectColumn($alias . '.value'); $criteria->addSelectColumn($alias . '.extra'); + $criteria->addSelectColumn($alias . '.criteriagroup'); $criteria->addSelectColumn($alias . '.block_id'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php index c91212458..ebe48189b 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcBlockcriteriaQuery.php @@ -11,6 +11,7 @@ * @method CcBlockcriteriaQuery orderByDbModifier($order = Criteria::ASC) Order by the modifier column * @method CcBlockcriteriaQuery orderByDbValue($order = Criteria::ASC) Order by the value column * @method CcBlockcriteriaQuery orderByDbExtra($order = Criteria::ASC) Order by the extra column + * @method CcBlockcriteriaQuery orderByDbCriteriaGroup($order = Criteria::ASC) Order by the criteriagroup column * @method CcBlockcriteriaQuery orderByDbBlockId($order = Criteria::ASC) Order by the block_id column * * @method CcBlockcriteriaQuery groupByDbId() Group by the id column @@ -18,6 +19,7 @@ * @method CcBlockcriteriaQuery groupByDbModifier() Group by the modifier column * @method CcBlockcriteriaQuery groupByDbValue() Group by the value column * @method CcBlockcriteriaQuery groupByDbExtra() Group by the extra column + * @method CcBlockcriteriaQuery groupByDbCriteriaGroup() Group by the criteriagroup column * @method CcBlockcriteriaQuery groupByDbBlockId() Group by the block_id column * * @method CcBlockcriteriaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query @@ -35,6 +37,7 @@ * @method CcBlockcriteria findOneByDbModifier(string $modifier) Return the first CcBlockcriteria filtered by the modifier column * @method CcBlockcriteria findOneByDbValue(string $value) Return the first CcBlockcriteria filtered by the value column * @method CcBlockcriteria findOneByDbExtra(string $extra) Return the first CcBlockcriteria filtered by the extra column + * @method CcBlockcriteria findOneByDbCriteriaGroup(int $criteriagroup) Return the first CcBlockcriteria filtered by the criteriagroup column * @method CcBlockcriteria findOneByDbBlockId(int $block_id) Return the first CcBlockcriteria filtered by the block_id column * * @method array findByDbId(int $id) Return CcBlockcriteria objects filtered by the id column @@ -42,6 +45,7 @@ * @method array findByDbModifier(string $modifier) Return CcBlockcriteria objects filtered by the modifier column * @method array findByDbValue(string $value) Return CcBlockcriteria objects filtered by the value column * @method array findByDbExtra(string $extra) Return CcBlockcriteria objects filtered by the extra column + * @method array findByDbCriteriaGroup(int $criteriagroup) Return CcBlockcriteria objects filtered by the criteriagroup column * @method array findByDbBlockId(int $block_id) Return CcBlockcriteria objects filtered by the block_id column * * @package propel.generator.airtime.om @@ -150,7 +154,7 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT "id", "criteria", "modifier", "value", "extra", "block_id" FROM "cc_blockcriteria" WHERE "id" = :p0'; + $sql = 'SELECT "id", "criteria", "modifier", "value", "extra", "criteriagroup", "block_id" FROM "cc_blockcriteria" WHERE "id" = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -397,6 +401,48 @@ abstract class BaseCcBlockcriteriaQuery extends ModelCriteria return $this->addUsingAlias(CcBlockcriteriaPeer::EXTRA, $dbExtra, $comparison); } + /** + * Filter the query on the criteriagroup column + * + * Example usage: + * + * $query->filterByDbCriteriaGroup(1234); // WHERE criteriagroup = 1234 + * $query->filterByDbCriteriaGroup(array(12, 34)); // WHERE criteriagroup IN (12, 34) + * $query->filterByDbCriteriaGroup(array('min' => 12)); // WHERE criteriagroup >= 12 + * $query->filterByDbCriteriaGroup(array('max' => 12)); // WHERE criteriagroup <= 12 + * + * + * @param mixed $dbCriteriaGroup 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 CcBlockcriteriaQuery The current query, for fluid interface + */ + public function filterByDbCriteriaGroup($dbCriteriaGroup = null, $comparison = null) + { + if (is_array($dbCriteriaGroup)) { + $useMinMax = false; + if (isset($dbCriteriaGroup['min'])) { + $this->addUsingAlias(CcBlockcriteriaPeer::CRITERIAGROUP, $dbCriteriaGroup['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($dbCriteriaGroup['max'])) { + $this->addUsingAlias(CcBlockcriteriaPeer::CRITERIAGROUP, $dbCriteriaGroup['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(CcBlockcriteriaPeer::CRITERIAGROUP, $dbCriteriaGroup, $comparison); + } + /** * Filter the query on the block_id column * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php index 1c634b382..b0552a756 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php @@ -74,7 +74,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent /** * The value for the trackoffset field. - * Note: this column has a database default value of: 0 + * Note: this column has a database default value of: 0.0 * @var double */ protected $trackoffset; @@ -161,7 +161,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent public function applyDefaultValues() { $this->type = 0; - $this->trackoffset = 0; + $this->trackoffset = 0.0; $this->cliplength = '00:00:00'; $this->cuein = '00:00:00'; $this->cueout = '00:00:00'; @@ -677,7 +677,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent return false; } - if ($this->trackoffset !== 0) { + if ($this->trackoffset !== 0.0) { return false; } diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index 7c46ce495..043780e7d 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -315,6 +315,7 @@ + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index aae02129e..02afe90cf 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -299,7 +299,7 @@ CREATE TABLE "cc_block" "creator_id" INTEGER, "description" VARCHAR(512), "length" interval DEFAULT '00:00:00', - "type" VARCHAR(7) DEFAULT 'dynamic', + "type" VARCHAR(7) DEFAULT 'static', PRIMARY KEY ("id") ); @@ -337,6 +337,7 @@ CREATE TABLE "cc_blockcriteria" "modifier" VARCHAR(16) NOT NULL, "value" VARCHAR(512) NOT NULL, "extra" VARCHAR(512), + "criteriagroup" INTEGER, "block_id" INTEGER NOT NULL, PRIMARY KEY ("id") );