CC-5762 : Playlist options validation
making sure playlist can generate with no criteria options set.
This commit is contained in:
parent
ddecfb0958
commit
a9df6bdba0
|
@ -556,29 +556,31 @@ abstract class Playlist extends BasePlaylist implements \Interface_Playlistable
|
|||
|
||||
$m = $query->getModelName();
|
||||
$query->withColumn("({$m}.Cueout - {$m}.Cuein)", "cuelength");
|
||||
|
||||
$criteriaRules = self::getCriteriaRules($query);
|
||||
|
||||
$conditionAnd = array();
|
||||
$conNum = 0;
|
||||
foreach ($criteria as $andBlock) {
|
||||
$conditionOr = array();
|
||||
|
||||
foreach ($andBlock as $orBlock) {
|
||||
$rule = $criteriaRules[$orBlock["modifier"]];
|
||||
|
||||
$column = $orBlock["criteria"];
|
||||
$condition = $rule($column, $orBlock);
|
||||
|
||||
$conditionOr[] = $condition;
|
||||
|
||||
//only add to where clause if criteria exist.
|
||||
if (count($criteria) > 0) {
|
||||
$criteriaRules = self::getCriteriaRules($query);
|
||||
$conditionAnd = array();
|
||||
$conNum = 0;
|
||||
foreach ($criteria as $andBlock) {
|
||||
$conditionOr = array();
|
||||
|
||||
foreach ($andBlock as $orBlock) {
|
||||
$rule = $criteriaRules[$orBlock["modifier"]];
|
||||
|
||||
$column = $orBlock["criteria"];
|
||||
$condition = $rule($column, $orBlock);
|
||||
|
||||
$conditionOr[] = $condition;
|
||||
}
|
||||
|
||||
$query->combine($conditionOr, 'or', $conNum);
|
||||
$conditionAnd[] = $conNum;
|
||||
$conNum++;
|
||||
}
|
||||
|
||||
$query->combine($conditionOr, 'or', $conNum);
|
||||
$conditionAnd[] = $conNum;
|
||||
$conNum++;
|
||||
}
|
||||
|
||||
$query->where($conditionAnd, 'and');
|
||||
|
||||
$query->where($conditionAnd, 'and');
|
||||
}
|
||||
|
||||
//order by a chosen column or by random.
|
||||
$order = $ruleSet["order"];
|
||||
|
|
|
@ -6,7 +6,7 @@ use Airtime\MediaItem\om\BasePlaylistPeer;
|
|||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'playlist' table.
|
||||
* Skeleton subclass for performing query and update operations on the 'media_playlist' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@ use Airtime\MediaItem\om\BasePlaylistQuery;
|
|||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'playlist' table.
|
||||
* Skeleton subclass for performing query and update operations on the 'media_playlist' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue