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();
|
$m = $query->getModelName();
|
||||||
$query->withColumn("({$m}.Cueout - {$m}.Cuein)", "cuelength");
|
$query->withColumn("({$m}.Cueout - {$m}.Cuein)", "cuelength");
|
||||||
|
|
||||||
$criteriaRules = self::getCriteriaRules($query);
|
//only add to where clause if criteria exist.
|
||||||
|
if (count($criteria) > 0) {
|
||||||
$conditionAnd = array();
|
$criteriaRules = self::getCriteriaRules($query);
|
||||||
$conNum = 0;
|
$conditionAnd = array();
|
||||||
foreach ($criteria as $andBlock) {
|
$conNum = 0;
|
||||||
$conditionOr = array();
|
foreach ($criteria as $andBlock) {
|
||||||
|
$conditionOr = array();
|
||||||
foreach ($andBlock as $orBlock) {
|
|
||||||
$rule = $criteriaRules[$orBlock["modifier"]];
|
foreach ($andBlock as $orBlock) {
|
||||||
|
$rule = $criteriaRules[$orBlock["modifier"]];
|
||||||
$column = $orBlock["criteria"];
|
|
||||||
$condition = $rule($column, $orBlock);
|
$column = $orBlock["criteria"];
|
||||||
|
$condition = $rule($column, $orBlock);
|
||||||
$conditionOr[] = $condition;
|
|
||||||
|
$conditionOr[] = $condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->combine($conditionOr, 'or', $conNum);
|
||||||
|
$conditionAnd[] = $conNum;
|
||||||
|
$conNum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->combine($conditionOr, 'or', $conNum);
|
$query->where($conditionAnd, 'and');
|
||||||
$conditionAnd[] = $conNum;
|
}
|
||||||
$conNum++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$query->where($conditionAnd, 'and');
|
|
||||||
|
|
||||||
//order by a chosen column or by random.
|
//order by a chosen column or by random.
|
||||||
$order = $ruleSet["order"];
|
$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