Merge pull request #8160 from open-sausages/pulls/3.7/validate-by-stage

BUG Error if invalid stage specified for get_by_stage
This commit is contained in:
Robbie Averill 2018-06-12 11:51:34 +12:00 committed by GitHub
commit 520138f081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1481,7 +1481,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider {
*/ */
public static function get_by_stage($class, $stage, $filter = '', $sort = '', $join = '', $limit = '', public static function get_by_stage($class, $stage, $filter = '', $sort = '', $join = '', $limit = '',
$containerClass = 'DataList') { $containerClass = 'DataList') {
VersionedReadingMode::validateStage($stage);
$result = DataObject::get($class, $filter, $sort, $join, $limit, $containerClass); $result = DataObject::get($class, $filter, $sort, $join, $limit, $containerClass);
return $result->setDataQueryParam(array( return $result->setDataQueryParam(array(
'Versioned.mode' => 'stage', 'Versioned.mode' => 'stage',