Fixed presentation update process
was failing event type update and speakers set Change-Id: I9cd3715d1c4ebed9729ed886218e06d3466b8007
This commit is contained in:
parent
fd1c65ffc7
commit
f6a42b8d8c
@ -12,40 +12,40 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\summit\Presentation;
|
||||
|
||||
/**
|
||||
* Class PresentationSerializer
|
||||
* @package ModelSerializers
|
||||
*/
|
||||
class PresentationSerializer extends SummitEventSerializer
|
||||
{
|
||||
protected static $array_mappings = array
|
||||
(
|
||||
protected static $array_mappings = [
|
||||
|
||||
'Level' => 'level',
|
||||
'ModeratorId' => 'moderator_speaker_id:json_int',
|
||||
'ProblemAddressed' => 'problem_addressed:json_string',
|
||||
'AttendeesExpectedLearnt' => 'attendees_expected_learnt:json_string',
|
||||
'ToRecord' => 'to_record:json_boolean',
|
||||
'FeatureCloud' => 'feature_cloud:json_boolean',
|
||||
);
|
||||
];
|
||||
|
||||
protected static $allowed_fields = [
|
||||
|
||||
protected static $allowed_fields = array
|
||||
(
|
||||
'track_id',
|
||||
'moderator_speaker_id',
|
||||
'level',
|
||||
'problem_addressed',
|
||||
'attendees_expected_learnt',
|
||||
'to_record'
|
||||
);
|
||||
'to_record',
|
||||
'feature_cloud',
|
||||
];
|
||||
|
||||
protected static $allowed_relations = [
|
||||
|
||||
protected static $allowed_relations = array
|
||||
(
|
||||
'slides',
|
||||
'videos',
|
||||
'speakers',
|
||||
'links',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
@ -92,7 +92,7 @@ class PresentationSerializer extends SummitEventSerializer
|
||||
|
||||
if(in_array('videos', $relations))
|
||||
{
|
||||
$videos = array();
|
||||
$videos = [];
|
||||
foreach ($presentation->getVideos() as $video) {
|
||||
$video_values = SerializerRegistry::getInstance()->getSerializer($video)->serialize();
|
||||
if(empty($video_values['youtube_id'])) continue;
|
||||
@ -105,7 +105,7 @@ class PresentationSerializer extends SummitEventSerializer
|
||||
foreach (explode(',', $expand) as $relation) {
|
||||
switch (trim($relation)) {
|
||||
case 'speakers': {
|
||||
$speakers = array();
|
||||
$speakers = [];
|
||||
foreach ($presentation->getSpeakers() as $s) {
|
||||
$speakers[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize();
|
||||
}
|
||||
|
@ -612,7 +612,19 @@ final class SummitService implements ISummitService
|
||||
$event = $this->event_repository->getById($event_id);
|
||||
if (is_null($event))
|
||||
throw new ValidationException(sprintf("event id %s does not exists!", $event_id));
|
||||
$event_type = $event->getType();
|
||||
$old_event_type = $event->getType();
|
||||
if($event_type != null && $old_event_type->getClassName() != $event_type->getClassName()){
|
||||
throw new ValidationException
|
||||
(
|
||||
sprintf
|
||||
(
|
||||
"invalid event type transition for event id %s ( from %s to %s)",
|
||||
$event_id,
|
||||
$old_event_type->getClassName(),
|
||||
$event_type->getClassName()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// main data
|
||||
|
Loading…
x
Reference in New Issue
Block a user