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.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
use models\summit\Presentation;
|
use models\summit\Presentation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PresentationSerializer
|
* Class PresentationSerializer
|
||||||
* @package ModelSerializers
|
* @package ModelSerializers
|
||||||
*/
|
*/
|
||||||
class PresentationSerializer extends SummitEventSerializer
|
class PresentationSerializer extends SummitEventSerializer
|
||||||
{
|
{
|
||||||
protected static $array_mappings = array
|
protected static $array_mappings = [
|
||||||
(
|
|
||||||
'Level' => 'level',
|
'Level' => 'level',
|
||||||
'ModeratorId' => 'moderator_speaker_id:json_int',
|
'ModeratorId' => 'moderator_speaker_id:json_int',
|
||||||
'ProblemAddressed' => 'problem_addressed:json_string',
|
'ProblemAddressed' => 'problem_addressed:json_string',
|
||||||
'AttendeesExpectedLearnt' => 'attendees_expected_learnt:json_string',
|
'AttendeesExpectedLearnt' => 'attendees_expected_learnt:json_string',
|
||||||
'ToRecord' => 'to_record:json_boolean',
|
'ToRecord' => 'to_record:json_boolean',
|
||||||
'FeatureCloud' => 'feature_cloud:json_boolean',
|
'FeatureCloud' => 'feature_cloud:json_boolean',
|
||||||
);
|
];
|
||||||
|
|
||||||
|
protected static $allowed_fields = [
|
||||||
|
|
||||||
protected static $allowed_fields = array
|
|
||||||
(
|
|
||||||
'track_id',
|
'track_id',
|
||||||
'moderator_speaker_id',
|
'moderator_speaker_id',
|
||||||
'level',
|
'level',
|
||||||
'problem_addressed',
|
'problem_addressed',
|
||||||
'attendees_expected_learnt',
|
'attendees_expected_learnt',
|
||||||
'to_record'
|
'to_record',
|
||||||
);
|
'feature_cloud',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected static $allowed_relations = [
|
||||||
|
|
||||||
protected static $allowed_relations = array
|
|
||||||
(
|
|
||||||
'slides',
|
'slides',
|
||||||
'videos',
|
'videos',
|
||||||
'speakers',
|
'speakers',
|
||||||
'links',
|
'links',
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $expand
|
* @param null $expand
|
||||||
@ -92,7 +92,7 @@ class PresentationSerializer extends SummitEventSerializer
|
|||||||
|
|
||||||
if(in_array('videos', $relations))
|
if(in_array('videos', $relations))
|
||||||
{
|
{
|
||||||
$videos = array();
|
$videos = [];
|
||||||
foreach ($presentation->getVideos() as $video) {
|
foreach ($presentation->getVideos() as $video) {
|
||||||
$video_values = SerializerRegistry::getInstance()->getSerializer($video)->serialize();
|
$video_values = SerializerRegistry::getInstance()->getSerializer($video)->serialize();
|
||||||
if(empty($video_values['youtube_id'])) continue;
|
if(empty($video_values['youtube_id'])) continue;
|
||||||
@ -105,7 +105,7 @@ class PresentationSerializer extends SummitEventSerializer
|
|||||||
foreach (explode(',', $expand) as $relation) {
|
foreach (explode(',', $expand) as $relation) {
|
||||||
switch (trim($relation)) {
|
switch (trim($relation)) {
|
||||||
case 'speakers': {
|
case 'speakers': {
|
||||||
$speakers = array();
|
$speakers = [];
|
||||||
foreach ($presentation->getSpeakers() as $s) {
|
foreach ($presentation->getSpeakers() as $s) {
|
||||||
$speakers[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize();
|
$speakers[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize();
|
||||||
}
|
}
|
||||||
|
@ -612,7 +612,19 @@ final class SummitService implements ISummitService
|
|||||||
$event = $this->event_repository->getById($event_id);
|
$event = $this->event_repository->getById($event_id);
|
||||||
if (is_null($event))
|
if (is_null($event))
|
||||||
throw new ValidationException(sprintf("event id %s does not exists!", $event_id));
|
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
|
// main data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user