Added missing model serializer for

PrivatePresentationCategoryGroup

Change-Id: Ic3b0f265c51e34d85167c04a37b7959279888e19
This commit is contained in:
Sebastian Marcet 2018-02-02 11:35:12 -03:00
parent d0090ea4a6
commit 0ecbe9c01a
4 changed files with 63 additions and 4 deletions

View File

@ -90,6 +90,7 @@ final class SerializerRegistry
$this->registry['SummitTicketType'] = SummitTicketTypeSerializer::class;
$this->registry['PresentationCategory'] = PresentationCategorySerializer::class;
$this->registry['PresentationCategoryGroup'] = PresentationCategoryGroupSerializer::class;
$this->registry['PrivatePresentationCategoryGroup'] = PrivatePresentationCategoryGroupSerializer::class;
$this->registry['Tag'] = TagSerializer::class;
$this->registry['SummitEvent'] = SummitEventSerializer::class;
$this->registry['SummitGroupEvent'] = SummitGroupEventSerializer::class;

View File

@ -16,14 +16,13 @@
* Class PresentationCategoryGroupSerializer
* @package ModelSerializers
*/
final class PresentationCategoryGroupSerializer extends SilverStripeSerializer
class PresentationCategoryGroupSerializer extends SilverStripeSerializer
{
protected static $array_mappings = array
(
protected static $array_mappings = [
'Name' => 'name:json_string',
'Color' => 'color:json_string',
'Description' => 'description:json_string',
);
];
/**
* @param null $expand

View File

@ -0,0 +1,27 @@
<?php namespace ModelSerializers;
/**
* Copyright 2018 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
/**
* Class PrivatePresentationCategoryGroupSerializer
* @package ModelSerializers
*/
final class PrivatePresentationCategoryGroupSerializer
extends PresentationCategoryGroupSerializer
{
protected static $array_mappings = [
'SubmissionBeginDate' => 'submission_begin_date:datetime_epoch',
'SubmissionEndDate' => 'submission_end_date:datetime_epoch',
'MaxSubmissionAllowedPerUser' => 'max_submission_allowed_per_user:json_int',
];
}

View File

@ -70,4 +70,36 @@ class PrivatePresentationCategoryGroup extends PresentationCategoryGroup
return ($now >= $start_date && $now <= $end_date);
}
/**
* @return DateTime
*/
public function getSubmissionBeginDate()
{
return $this->submission_begin_date;
}
/**
* @return DateTime
*/
public function getSubmissionEndDate()
{
return $this->submission_end_date;
}
/**
* @return int
*/
public function getMaxSubmissionAllowedPerUser()
{
return $this->max_submission_allowed_per_user;
}
/**
* @return Group[]
*/
public function getAllowedGroups()
{
return $this->allowed_groups;
}
}