Added new Endpoint getspeaker
added new endpoint getspeaker without summit GET /api/v1/speakers/{speaker_id} Change-Id: Ib5841b6ba7674be37268c1459aff328fc26c7eda
This commit is contained in:
parent
381ca80de8
commit
404fbfdb29
@ -26,6 +26,7 @@ use models\summit\IEventFeedbackRepository;
|
|||||||
use models\summit\ISpeakerRepository;
|
use models\summit\ISpeakerRepository;
|
||||||
use models\summit\ISummitEventRepository;
|
use models\summit\ISummitEventRepository;
|
||||||
use models\summit\ISummitRepository;
|
use models\summit\ISummitRepository;
|
||||||
|
use ModelSerializers\ISerializerTypeSelector;
|
||||||
use ModelSerializers\SerializerRegistry;
|
use ModelSerializers\SerializerRegistry;
|
||||||
use services\model\ISpeakerService;
|
use services\model\ISpeakerService;
|
||||||
use services\model\ISummitService;
|
use services\model\ISummitService;
|
||||||
@ -65,6 +66,10 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
*/
|
*/
|
||||||
private $member_repository;
|
private $member_repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ISerializerTypeSelector
|
||||||
|
*/
|
||||||
|
private $serializer_type_selector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OAuth2SummitSpeakersApiController constructor.
|
* OAuth2SummitSpeakersApiController constructor.
|
||||||
@ -74,6 +79,7 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
* @param IEventFeedbackRepository $event_feedback_repository
|
* @param IEventFeedbackRepository $event_feedback_repository
|
||||||
* @param IMemberRepository $member_repository
|
* @param IMemberRepository $member_repository
|
||||||
* @param ISpeakerService $service
|
* @param ISpeakerService $service
|
||||||
|
* @param ISerializerTypeSelector $serializer_type_selector
|
||||||
* @param IResourceServerContext $resource_server_context
|
* @param IResourceServerContext $resource_server_context
|
||||||
*/
|
*/
|
||||||
public function __construct
|
public function __construct
|
||||||
@ -84,6 +90,7 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
IEventFeedbackRepository $event_feedback_repository,
|
IEventFeedbackRepository $event_feedback_repository,
|
||||||
IMemberRepository $member_repository,
|
IMemberRepository $member_repository,
|
||||||
ISpeakerService $service,
|
ISpeakerService $service,
|
||||||
|
ISerializerTypeSelector $serializer_type_selector,
|
||||||
IResourceServerContext $resource_server_context
|
IResourceServerContext $resource_server_context
|
||||||
) {
|
) {
|
||||||
parent::__construct($resource_server_context);
|
parent::__construct($resource_server_context);
|
||||||
@ -93,6 +100,7 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
$this->member_repository = $member_repository;
|
$this->member_repository = $member_repository;
|
||||||
$this->event_feedback_repository = $event_feedback_repository;
|
$this->event_feedback_repository = $event_feedback_repository;
|
||||||
$this->service = $service;
|
$this->service = $service;
|
||||||
|
$this->serializer_type_selector = $serializer_type_selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +114,6 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
public function getSpeakers($summit_id)
|
public function getSpeakers($summit_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$serializer_type = SerializerRegistry::SerializerType_Public;
|
|
||||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
||||||
if (is_null($summit)) return $this->error404();
|
if (is_null($summit)) return $this->error404();
|
||||||
|
|
||||||
@ -161,12 +168,7 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_member_id = $this->resource_server_context->getCurrentUserExternalId();
|
$serializer_type = $this->serializer_type_selector->getSerializerType();
|
||||||
if(!is_null($current_member_id) && $member = $this->member_repository->getById($current_member_id)){
|
|
||||||
if($member->isOnGroup(Group::SummitAdministrators)){
|
|
||||||
$serializer_type = SerializerRegistry::SerializerType_Private;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$result = $this->speaker_repository->getSpeakersBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
$result = $this->speaker_repository->getSpeakersBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||||
|
|
||||||
return $this->ok
|
return $this->ok
|
||||||
@ -190,12 +192,15 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get all speakers without summit
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getAll(){
|
public function getAll(){
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$values = Input::all();
|
$values = Input::all();
|
||||||
$serializer_type = SerializerRegistry::SerializerType_Public;
|
$serializer_type = $this->serializer_type_selector->getSerializerType();
|
||||||
$rules = [
|
$rules = [
|
||||||
'page' => 'integer|min:1',
|
'page' => 'integer|min:1',
|
||||||
'per_page' => 'required_with:page|integer|min:10|max:100',
|
'per_page' => 'required_with:page|integer|min:10|max:100',
|
||||||
@ -246,13 +251,6 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
|
|
||||||
$result = $this->speaker_repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order);
|
$result = $this->speaker_repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order);
|
||||||
|
|
||||||
$current_member_id = $this->resource_server_context->getCurrentUserExternalId();
|
|
||||||
if(!is_null($current_member_id) && $member = $this->member_repository->getById($current_member_id)){
|
|
||||||
if($member->isOnGroup(Group::SummitAdministrators)){
|
|
||||||
$serializer_type = SerializerRegistry::SerializerType_Private;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->ok
|
return $this->ok
|
||||||
(
|
(
|
||||||
$result->toArray(Request::input('expand', ''),[] ,[], [], $serializer_type)
|
$result->toArray(Request::input('expand', ''),[] ,[], [], $serializer_type)
|
||||||
@ -279,23 +277,17 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
* @param $speaker_id
|
* @param $speaker_id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getSpeaker($summit_id, $speaker_id)
|
public function getSummitSpeaker($summit_id, $speaker_id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$serializer_type = SerializerRegistry::SerializerType_Public;
|
|
||||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
||||||
if (is_null($summit)) return $this->error404();
|
if (is_null($summit)) return $this->error404();
|
||||||
|
|
||||||
$speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check($speaker_id, $summit);
|
$speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check($speaker_id, $summit);
|
||||||
if (is_null($speaker)) return $this->error404();
|
if (is_null($speaker)) return $this->error404();
|
||||||
|
|
||||||
$current_member_id = $this->resource_server_context->getCurrentUserExternalId();
|
$serializer_type = $this->serializer_type_selector->getSerializerType();
|
||||||
if(!is_null($current_member_id) && $member = $this->member_repository->getById($current_member_id)){
|
|
||||||
if($member->isOnGroup(Group::SummitAdministrators)){
|
|
||||||
$serializer_type = SerializerRegistry::SerializerType_Private;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->ok
|
return $this->ok
|
||||||
(
|
(
|
||||||
@ -324,6 +316,47 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $speaker_id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getSpeaker($speaker_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
$speaker = $this->speaker_repository->getById($speaker_id);
|
||||||
|
if (is_null($speaker)) return $this->error404();
|
||||||
|
|
||||||
|
$serializer_type = $this->serializer_type_selector->getSerializerType();
|
||||||
|
|
||||||
|
return $this->ok
|
||||||
|
(
|
||||||
|
SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize
|
||||||
|
(
|
||||||
|
Request::input('expand', ''),
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(ValidationException $ex1){
|
||||||
|
Log::warning($ex1);
|
||||||
|
return $this->error412($ex1->getMessages());
|
||||||
|
}
|
||||||
|
catch(EntityNotFoundException $ex2)
|
||||||
|
{
|
||||||
|
Log::warning($ex2);
|
||||||
|
return $this->error404(array('message'=> $ex2->getMessage()));
|
||||||
|
}
|
||||||
|
catch (Exception $ex) {
|
||||||
|
Log::error($ex);
|
||||||
|
return $this->error500($ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function addSpeaker($summit_id){
|
public function addSpeaker($summit_id){
|
||||||
try {
|
try {
|
||||||
if(!Request::isJson()) return $this->error403();
|
if(!Request::isJson()) return $this->error403();
|
||||||
|
@ -185,7 +185,7 @@ Route::group([
|
|||||||
Route::get('', 'OAuth2SummitSpeakersApiController@getSpeakers');
|
Route::get('', 'OAuth2SummitSpeakersApiController@getSpeakers');
|
||||||
|
|
||||||
Route::group(['prefix' => '{speaker_id}'], function () {
|
Route::group(['prefix' => '{speaker_id}'], function () {
|
||||||
Route::get('', 'OAuth2SummitSpeakersApiController@getSpeaker')->where('speaker_id', 'me|[0-9]+');
|
Route::get('', 'OAuth2SummitSpeakersApiController@getSummitSpeaker')->where('speaker_id', 'me|[0-9]+');
|
||||||
Route::put('',[ 'middleware' => 'auth.user:administrators', 'uses' => 'OAuth2SummitSpeakersApiController@updateSpeaker'])->where('speaker_id', 'me|[0-9]+');
|
Route::put('',[ 'middleware' => 'auth.user:administrators', 'uses' => 'OAuth2SummitSpeakersApiController@updateSpeaker'])->where('speaker_id', 'me|[0-9]+');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -314,6 +314,7 @@ Route::group([
|
|||||||
Route::get('', 'OAuth2SummitSpeakersApiController@getAll');
|
Route::get('', 'OAuth2SummitSpeakersApiController@getAll');
|
||||||
|
|
||||||
Route::group(['prefix' => '{speaker_id}'], function () {
|
Route::group(['prefix' => '{speaker_id}'], function () {
|
||||||
|
Route::get('', 'OAuth2SummitSpeakersApiController@getSpeaker');
|
||||||
Route::post('/photo', [ 'middleware' => 'auth.user:administrators', 'uses' => 'OAuth2SummitSpeakersApiController@addSpeakerPhoto']);
|
Route::post('/photo', [ 'middleware' => 'auth.user:administrators', 'uses' => 'OAuth2SummitSpeakersApiController@addSpeakerPhoto']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
<?php namespace ModelSerializers;
|
|
||||||
/**
|
|
||||||
* Copyright 2017 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.
|
|
||||||
**/
|
|
||||||
|
|
||||||
use models\summit\PresentationSpeaker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AdminPresentationSpeakerSerializer
|
|
||||||
* @package ModelSerializers
|
|
||||||
*/
|
|
||||||
final class AdminPresentationSpeakerSerializer extends PresentationSpeakerSerializer
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param null $expand
|
|
||||||
* @param array $fields
|
|
||||||
* @param array $relations
|
|
||||||
* @param array $params
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function serialize($expand = null, array $fields = [], array $relations = [], array $params = [] )
|
|
||||||
{
|
|
||||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
|
||||||
|
|
||||||
$speaker = $this->object;
|
|
||||||
if(!$speaker instanceof PresentationSpeaker) return [];
|
|
||||||
|
|
||||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
|
||||||
$values['email'] = $speaker->getEmail();
|
|
||||||
$summit = isset($params['summit'])? $params['summit']:null;
|
|
||||||
|
|
||||||
if(!is_null($summit)){
|
|
||||||
$summit_assistance = $speaker->getAssistanceFor($summit);
|
|
||||||
if($summit_assistance){
|
|
||||||
$values['summit_assistance'] = SerializerRegistry::getInstance()->getSerializer($summit_assistance)->serialize();
|
|
||||||
}
|
|
||||||
$registration_code = $speaker->getPromoCodeFor($summit);
|
|
||||||
if($registration_code){
|
|
||||||
$values['registration_code'] = SerializerRegistry::getInstance()->getSerializer($registration_code)->serialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
$values['all_presentations'] = $speaker->getPresentationIds($summit->getId() ,false);
|
|
||||||
$values['all_moderated_presentations'] = $speaker->getModeratedPresentationIds($summit->getId(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($expand)) {
|
|
||||||
foreach (explode(',', $expand) as $relation) {
|
|
||||||
switch (trim($relation)) {
|
|
||||||
case 'presentations': {
|
|
||||||
if(is_null($summit)) continue;
|
|
||||||
$presentations = [];
|
|
||||||
foreach ($speaker->getPresentations($summit->getId(), false) as $p) {
|
|
||||||
$presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize();
|
|
||||||
}
|
|
||||||
$values['all_presentations'] = $presentations;
|
|
||||||
|
|
||||||
$moderated_presentations = [];
|
|
||||||
foreach ($speaker->getModeratedPresentations($summit->getId(), false) as $p) {
|
|
||||||
$moderated_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize();
|
|
||||||
}
|
|
||||||
$values['all_moderated_presentations'] = $presentations;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $values;
|
|
||||||
}
|
|
||||||
}
|
|
63
app/ModelSerializers/BaseSerializerTypeSelector.php
Normal file
63
app/ModelSerializers/BaseSerializerTypeSelector.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
use models\main\IMemberRepository;
|
||||||
|
use models\oauth2\IResourceServerContext;
|
||||||
|
use models\main\Group;
|
||||||
|
/**
|
||||||
|
* Class BaseSerializerTypeSelector
|
||||||
|
* @package ModelSerializers
|
||||||
|
*/
|
||||||
|
final class BaseSerializerTypeSelector implements ISerializerTypeSelector
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IResourceServerContext
|
||||||
|
*/
|
||||||
|
private $resource_server_context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var IMemberRepository
|
||||||
|
*/
|
||||||
|
private $member_repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaseSerializerTypeSelector constructor.
|
||||||
|
* @param IMemberRepository $member_repository
|
||||||
|
* @param IResourceServerContext $resource_server_context
|
||||||
|
*/
|
||||||
|
public function __construct
|
||||||
|
(
|
||||||
|
IMemberRepository $member_repository,
|
||||||
|
IResourceServerContext $resource_server_context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$this->resource_server_context = $resource_server_context;
|
||||||
|
$this->member_repository = $member_repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSerializerType()
|
||||||
|
{
|
||||||
|
$serializer_type = SerializerRegistry::SerializerType_Public;
|
||||||
|
$current_member_id = $this->resource_server_context->getCurrentUserExternalId();
|
||||||
|
if(!is_null($current_member_id) && $member = $this->member_repository->getById($current_member_id)){
|
||||||
|
if($member->isOnGroup(Group::SummitAdministrators)){
|
||||||
|
$serializer_type = SerializerRegistry::SerializerType_Private;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $serializer_type;
|
||||||
|
}
|
||||||
|
}
|
21
app/ModelSerializers/ISerializerTypeSelector.php
Normal file
21
app/ModelSerializers/ISerializerTypeSelector.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
|
||||||
|
interface ISerializerTypeSelector
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSerializerType();
|
||||||
|
}
|
@ -106,6 +106,13 @@ final class SerializerRegistry
|
|||||||
self::SerializerType_Private => AdminPresentationSpeakerSerializer::class
|
self::SerializerType_Private => AdminPresentationSpeakerSerializer::class
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$this->registry['SpeakerExpertise'] = SpeakerExpertiseSerializer::class;
|
||||||
|
$this->registry['SpeakerLanguage'] = SpeakerLanguageSerializer::class;
|
||||||
|
$this->registry['SpeakerTravelPreference'] = SpeakerTravelPreferenceSerializer::class;
|
||||||
|
$this->registry['SpeakerPresentationLink'] = SpeakerPresentationLinkSerializer::class;
|
||||||
|
$this->registry['SpeakerActiveInvolvement'] = SpeakerActiveInvolvementSerializer::class;
|
||||||
|
$this->registry['SpeakerOrganizationalRole'] = SpeakerOrganizationalRoleSerializer::class;
|
||||||
|
|
||||||
$this->registry['SummitEventFeedback'] = SummitEventFeedbackSerializer::class;
|
$this->registry['SummitEventFeedback'] = SummitEventFeedbackSerializer::class;
|
||||||
$this->registry['SummitAttendee'] = SummitAttendeeSerializer::class;
|
$this->registry['SummitAttendee'] = SummitAttendeeSerializer::class;
|
||||||
$this->registry['SummitMemberSchedule'] = SummitMemberScheduleSerializer::class;
|
$this->registry['SummitMemberSchedule'] = SummitMemberScheduleSerializer::class;
|
||||||
|
@ -0,0 +1,144 @@
|
|||||||
|
<?php namespace ModelSerializers;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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.
|
||||||
|
**/
|
||||||
|
|
||||||
|
use models\summit\PresentationSpeaker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AdminPresentationSpeakerSerializer
|
||||||
|
* @package ModelSerializers
|
||||||
|
*/
|
||||||
|
final class AdminPresentationSpeakerSerializer extends PresentationSpeakerSerializer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param null $expand
|
||||||
|
* @param array $fields
|
||||||
|
* @param array $relations
|
||||||
|
* @param array $params
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function serialize($expand = null, array $fields = [], array $relations = [], array $params = [] )
|
||||||
|
{
|
||||||
|
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||||
|
|
||||||
|
$speaker = $this->object;
|
||||||
|
if(!$speaker instanceof PresentationSpeaker) return [];
|
||||||
|
|
||||||
|
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||||
|
$values['email'] = $speaker->getEmail();
|
||||||
|
$summit = isset($params['summit'])? $params['summit']:null;
|
||||||
|
|
||||||
|
if(!is_null($summit)){
|
||||||
|
$summit_assistance = $speaker->getAssistanceFor($summit);
|
||||||
|
if($summit_assistance){
|
||||||
|
$values['summit_assistance'] = SerializerRegistry::getInstance()->getSerializer($summit_assistance)->serialize();
|
||||||
|
}
|
||||||
|
$registration_code = $speaker->getPromoCodeFor($summit);
|
||||||
|
if($registration_code){
|
||||||
|
$values['registration_code'] = SerializerRegistry::getInstance()->getSerializer($registration_code)->serialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['all_presentations'] = $speaker->getPresentationIds($summit->getId() ,false);
|
||||||
|
$values['all_moderated_presentations'] = $speaker->getModeratedPresentationIds($summit->getId(), false);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// get all summits info
|
||||||
|
$summit_assistances = [];
|
||||||
|
foreach ($speaker->getSummitAssistances() as $assistance){
|
||||||
|
$summit_assistances[] = SerializerRegistry::getInstance()->getSerializer($assistance)->serialize();
|
||||||
|
}
|
||||||
|
$values['summit_assistances'] = $summit_assistances;
|
||||||
|
|
||||||
|
$registration_codes = [];
|
||||||
|
foreach ($speaker->getPromoCodes() as $promo_code){
|
||||||
|
$registration_codes[] = SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize();
|
||||||
|
}
|
||||||
|
$values['registration_codes'] = $registration_codes;
|
||||||
|
|
||||||
|
$values['all_presentations'] = $speaker->getAllPresentationIds(false);
|
||||||
|
$values['all_moderated_presentations'] = $speaker->getAllModeratedPresentationIds( false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$languages = [];
|
||||||
|
foreach ($speaker->getLanguages() as $language){
|
||||||
|
$languages[] = SerializerRegistry::getInstance()->getSerializer($language)->serialize();
|
||||||
|
}
|
||||||
|
$values['languages'] = $languages;
|
||||||
|
|
||||||
|
$other_presentation_links = [];
|
||||||
|
foreach ($speaker->getOtherPresentationLinks() as $link){
|
||||||
|
$other_presentation_links[] = SerializerRegistry::getInstance()->getSerializer($link)->serialize();
|
||||||
|
}
|
||||||
|
$values['other_presentation_links'] = $other_presentation_links;
|
||||||
|
|
||||||
|
$areas_of_expertise = [];
|
||||||
|
foreach ($speaker->getAreasOfExpertise() as $exp){
|
||||||
|
$areas_of_expertise[] = SerializerRegistry::getInstance()->getSerializer($exp)->serialize();
|
||||||
|
}
|
||||||
|
$values['areas_of_expertise'] = $areas_of_expertise;
|
||||||
|
|
||||||
|
$travel_preferences = [];
|
||||||
|
foreach ($speaker->getTravelPreferences() as $tp){
|
||||||
|
$travel_preferences[] = SerializerRegistry::getInstance()->getSerializer($tp)->serialize();
|
||||||
|
}
|
||||||
|
$values['travel_preferences'] = $travel_preferences;
|
||||||
|
|
||||||
|
$active_involvements = [];
|
||||||
|
foreach ($speaker->getActiveInvolvements() as $ai){
|
||||||
|
$active_involvements[] = SerializerRegistry::getInstance()->getSerializer($ai)->serialize();
|
||||||
|
}
|
||||||
|
$values['active_involvements'] = $active_involvements;
|
||||||
|
|
||||||
|
$organizational_roles = [];
|
||||||
|
foreach ($speaker->getOrganizationalRoles() as $or){
|
||||||
|
$organizational_roles[] = SerializerRegistry::getInstance()->getSerializer($or)->serialize();
|
||||||
|
}
|
||||||
|
$values['organizational_roles'] = $organizational_roles;
|
||||||
|
|
||||||
|
if (!empty($expand)) {
|
||||||
|
foreach (explode(',', $expand) as $relation) {
|
||||||
|
switch (trim($relation)) {
|
||||||
|
case 'presentations': {
|
||||||
|
$presentations = [];
|
||||||
|
$moderated_presentations = [];
|
||||||
|
if(is_null($summit)){
|
||||||
|
|
||||||
|
foreach ($speaker->getAllPresentations( false) as $p) {
|
||||||
|
$presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($speaker->getAllModeratedPresentations(false) as $p) {
|
||||||
|
$moderated_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
foreach ($speaker->getPresentations($summit->getId(), false) as $p) {
|
||||||
|
$presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($speaker->getModeratedPresentations($summit->getId(), false) as $p) {
|
||||||
|
$moderated_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['all_presentations'] = $presentations;
|
||||||
|
$values['all_moderated_presentations'] = $moderated_presentations;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
final class SpeakerActiveInvolvementSerializer
|
||||||
|
extends SilverStripeSerializer
|
||||||
|
{
|
||||||
|
protected static $array_mappings = [
|
||||||
|
'Involvement' => 'involvement:json_string',
|
||||||
|
'IsDefault' => 'is_default:json_boolean',
|
||||||
|
];
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
final class SpeakerExpertiseSerializer
|
||||||
|
extends SilverStripeSerializer
|
||||||
|
{
|
||||||
|
protected static $array_mappings = [
|
||||||
|
'Expertise' => 'expertise:json_string',
|
||||||
|
'SpeakerId' => 'speaker_id:json_int',
|
||||||
|
];
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
final class SpeakerLanguageSerializer
|
||||||
|
extends SilverStripeSerializer
|
||||||
|
{
|
||||||
|
protected static $array_mappings = [
|
||||||
|
'Language' => 'language:json_string',
|
||||||
|
'SpeakerId' => 'speaker_id:json_int',
|
||||||
|
];
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
final class SpeakerOrganizationalRoleSerializer
|
||||||
|
extends SilverStripeSerializer
|
||||||
|
{
|
||||||
|
protected static $array_mappings = [
|
||||||
|
'Role' => 'role:json_string',
|
||||||
|
'IsDefault' => 'is_default:json_boolean',
|
||||||
|
];
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
final class SpeakerPresentationLinkSerializer
|
||||||
|
extends SilverStripeSerializer
|
||||||
|
{
|
||||||
|
protected static $array_mappings = [
|
||||||
|
'Link' => 'link:json_string',
|
||||||
|
'Title' => 'title:json_string',
|
||||||
|
'SpeakerId' => 'speaker_id:json_int',
|
||||||
|
];
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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.
|
||||||
|
**/
|
||||||
|
final class SpeakerTravelPreferenceSerializer
|
||||||
|
extends SilverStripeSerializer
|
||||||
|
{
|
||||||
|
protected static $array_mappings = [
|
||||||
|
'Country' => 'country:json_string',
|
||||||
|
'SpeakerId' => 'speaker_id:json_int',
|
||||||
|
];
|
||||||
|
}
|
@ -70,6 +70,42 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
*/
|
*/
|
||||||
private $created_from_api;
|
private $created_from_api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="AvailableForBureau", type="boolean")
|
||||||
|
*/
|
||||||
|
private $available_for_bureau;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="FundedTravel", type="boolean")
|
||||||
|
*/
|
||||||
|
private $funded_travel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="WillingToTravel", type="boolean")
|
||||||
|
*/
|
||||||
|
private $willing_to_travel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Country", type="string")
|
||||||
|
*/
|
||||||
|
private $country;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="WillingToPresentVideo", type="boolean")
|
||||||
|
*/
|
||||||
|
private $willing_to_presentVideo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Notes", type="string")
|
||||||
|
*/
|
||||||
|
private $notes;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="OrgHasCloud", type="boolean")
|
||||||
|
*/
|
||||||
|
private $org_has_cloud;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity="SpeakerRegistrationRequest", cascade={"persist"})
|
* @ORM\ManyToOne(targetEntity="SpeakerRegistrationRequest", cascade={"persist"})
|
||||||
* @ORM\JoinColumn(name="RegistrationRequestID", referencedColumnName="ID")
|
* @ORM\JoinColumn(name="RegistrationRequestID", referencedColumnName="ID")
|
||||||
@ -116,7 +152,51 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
private $member;
|
private $member;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @ORM\OneToMany(targetEntity="SpeakerExpertise", mappedBy="speaker", cascade={"persist"})
|
||||||
|
* @var SpeakerExpertise[]
|
||||||
|
*/
|
||||||
|
private $areas_of_expertise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="SpeakerPresentationLink", mappedBy="speaker", cascade={"persist"})
|
||||||
|
* @var SpeakerPresentationLink[]
|
||||||
|
*/
|
||||||
|
private $other_presentation_links;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="SpeakerTravelPreference", mappedBy="speaker", cascade={"persist"})
|
||||||
|
* @var SpeakerTravelPreference[]
|
||||||
|
*/
|
||||||
|
private $travel_preferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="SpeakerLanguage", mappedBy="speaker", cascade={"persist"})
|
||||||
|
* @var SpeakerLanguage[]
|
||||||
|
*/
|
||||||
|
private $languages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="SpeakerOrganizationalRole", cascade={"persist"})
|
||||||
|
* @ORM\JoinTable(name="PresentationSpeaker_OrganizationalRoles",
|
||||||
|
* joinColumns={@ORM\JoinColumn(name="PresentationSpeakerID", referencedColumnName="ID")},
|
||||||
|
* inverseJoinColumns={@ORM\JoinColumn(name="SpeakerOrganizationalRoleID", referencedColumnName="ID")}
|
||||||
|
* )
|
||||||
|
* @var SpeakerOrganizationalRole[]
|
||||||
|
*/
|
||||||
|
protected $organizational_roles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="SpeakerOrganizationalRole", cascade={"persist"})
|
||||||
|
* @ORM\JoinTable(name="PresentationSpeaker_ActiveInvolvements",
|
||||||
|
* joinColumns={@ORM\JoinColumn(name="PresentationSpeakerID", referencedColumnName="ID")},
|
||||||
|
* inverseJoinColumns={@ORM\JoinColumn(name="SpeakerActiveInvolvementID", referencedColumnName="ID")}
|
||||||
|
* )
|
||||||
|
* @var SpeakerActiveInvolvement[]
|
||||||
|
*/
|
||||||
|
protected $active_involvements;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFirstName()
|
public function getFirstName()
|
||||||
{
|
{
|
||||||
@ -219,6 +299,12 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
$this->moderated_presentations = new ArrayCollection;
|
$this->moderated_presentations = new ArrayCollection;
|
||||||
$this->summit_assistances = new ArrayCollection;
|
$this->summit_assistances = new ArrayCollection;
|
||||||
$this->promo_codes = new ArrayCollection;
|
$this->promo_codes = new ArrayCollection;
|
||||||
|
$this->areas_of_expertise = new ArrayCollection;
|
||||||
|
$this->other_presentation_links = new ArrayCollection;
|
||||||
|
$this->travel_preferences = new ArrayCollection;
|
||||||
|
$this->languages = new ArrayCollection;
|
||||||
|
$this->organizational_roles = new ArrayCollection;
|
||||||
|
$this->active_involvements = new ArrayCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,7 +314,6 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
$this->presentations->add($presentation);
|
$this->presentations->add($presentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function clearPresentations(){
|
public function clearPresentations(){
|
||||||
foreach($this->presentations as $presentation){
|
foreach($this->presentations as $presentation){
|
||||||
$presentation->removeSpeaker($this);
|
$presentation->removeSpeaker($this);
|
||||||
@ -255,6 +340,13 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ArrayCollection|SpeakerSummitRegistrationPromoCode[]
|
||||||
|
*/
|
||||||
|
public function getPromoCodes(){
|
||||||
|
return $this->promo_codes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Summit $summit
|
* @param Summit $summit
|
||||||
* @return SpeakerSummitRegistrationPromoCode
|
* @return SpeakerSummitRegistrationPromoCode
|
||||||
@ -319,6 +411,17 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|true $published_ones
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAllPresentationIds($published_ones = true)
|
||||||
|
{
|
||||||
|
return $this->presentations(null, $published_ones)->map(function($entity) {
|
||||||
|
return $entity->getId();
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $summit_id
|
* @param null $summit_id
|
||||||
* @param bool|true $published_ones
|
* @param bool|true $published_ones
|
||||||
@ -331,6 +434,17 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|true $published_ones
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAllPresentations($published_ones = true)
|
||||||
|
{
|
||||||
|
return $this->presentations(null, $published_ones)->map(function($entity) {
|
||||||
|
return $entity;
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $summit_id
|
* @param null $summit_id
|
||||||
@ -344,6 +458,17 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|true $published_ones
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAllModeratedPresentationIds($published_ones = true)
|
||||||
|
{
|
||||||
|
return $this->moderated_presentations(null, $published_ones)->map(function($entity) {
|
||||||
|
return $entity->getId();
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $summit_id
|
* @param null $summit_id
|
||||||
* @param bool|true $published_ones
|
* @param bool|true $published_ones
|
||||||
@ -356,6 +481,17 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|true $published_ones
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAllModeratedPresentations($published_ones = true)
|
||||||
|
{
|
||||||
|
return $this->moderated_presentations(null, $published_ones)->map(function($entity) {
|
||||||
|
return $entity;
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return File
|
* @return File
|
||||||
*/
|
*/
|
||||||
@ -624,4 +760,165 @@ SQL;
|
|||||||
public function inserted($args){
|
public function inserted($args){
|
||||||
Event::fire(new PresentationSpeakerCreated($this, $args));
|
Event::fire(new PresentationSpeakerCreated($this, $args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isAvailableForBureau()
|
||||||
|
{
|
||||||
|
return $this->available_for_bureau;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $available_for_bureau
|
||||||
|
*/
|
||||||
|
public function setAvailableForBureau($available_for_bureau)
|
||||||
|
{
|
||||||
|
$this->available_for_bureau = $available_for_bureau;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isFundedTravel()
|
||||||
|
{
|
||||||
|
return $this->funded_travel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $funded_travel
|
||||||
|
*/
|
||||||
|
public function setFundedTravel($funded_travel)
|
||||||
|
{
|
||||||
|
$this->funded_travel = $funded_travel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isWillingToTravel()
|
||||||
|
{
|
||||||
|
return $this->willing_to_travel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $willing_to_travel
|
||||||
|
*/
|
||||||
|
public function setWillingToTravel($willing_to_travel)
|
||||||
|
{
|
||||||
|
$this->willing_to_travel = $willing_to_travel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCountry()
|
||||||
|
{
|
||||||
|
return $this->country;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $country
|
||||||
|
*/
|
||||||
|
public function setCountry($country)
|
||||||
|
{
|
||||||
|
$this->country = $country;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isWillingToPresentVideo()
|
||||||
|
{
|
||||||
|
return $this->willing_to_presentVideo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $willing_to_presentVideo
|
||||||
|
*/
|
||||||
|
public function setWillingToPresentVideo($willing_to_presentVideo)
|
||||||
|
{
|
||||||
|
$this->willing_to_presentVideo = $willing_to_presentVideo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getNotes()
|
||||||
|
{
|
||||||
|
return $this->notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $notes
|
||||||
|
*/
|
||||||
|
public function setNotes($notes)
|
||||||
|
{
|
||||||
|
$this->notes = $notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isOrgHasCloud()
|
||||||
|
{
|
||||||
|
return $this->org_has_cloud;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $org_has_cloud
|
||||||
|
*/
|
||||||
|
public function setOrgHasCloud($org_has_cloud)
|
||||||
|
{
|
||||||
|
$this->org_has_cloud = $org_has_cloud;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SpeakerExpertise[]
|
||||||
|
*/
|
||||||
|
public function getAreasOfExpertise()
|
||||||
|
{
|
||||||
|
return $this->areas_of_expertise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SpeakerPresentationLink[]
|
||||||
|
*/
|
||||||
|
public function getOtherPresentationLinks()
|
||||||
|
{
|
||||||
|
return $this->other_presentation_links;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SpeakerTravelPreference[]
|
||||||
|
*/
|
||||||
|
public function getTravelPreferences()
|
||||||
|
{
|
||||||
|
return $this->travel_preferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SpeakerLanguage[]
|
||||||
|
*/
|
||||||
|
public function getLanguages()
|
||||||
|
{
|
||||||
|
return $this->languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SpeakerOrganizationalRole[]
|
||||||
|
*/
|
||||||
|
public function getOrganizationalRoles()
|
||||||
|
{
|
||||||
|
return $this->organizational_roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SpeakerActiveInvolvement[]
|
||||||
|
*/
|
||||||
|
public function getActiveInvolvements()
|
||||||
|
{
|
||||||
|
return $this->active_involvements;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
**/
|
||||||
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
|
use models\utils\SilverstripeBaseModel;
|
||||||
|
/**
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SpeakerActiveInvolvement")
|
||||||
|
* Class SpeakerActiveInvolvement
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SpeakerActiveInvolvement extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Involvement", type="string")
|
||||||
|
*/
|
||||||
|
private $involvement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="IsDefault", type="boolean")
|
||||||
|
*/
|
||||||
|
private $is_default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getInvolvement()
|
||||||
|
{
|
||||||
|
return $this->involvement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $involvement
|
||||||
|
*/
|
||||||
|
public function setInvolvement($involvement)
|
||||||
|
{
|
||||||
|
$this->involvement = $involvement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isDefault()
|
||||||
|
{
|
||||||
|
return $this->is_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $is_default
|
||||||
|
*/
|
||||||
|
public function setIsDefault($is_default)
|
||||||
|
{
|
||||||
|
$this->is_default = $is_default;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
**/
|
||||||
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
|
use models\utils\SilverstripeBaseModel;
|
||||||
|
/**
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SpeakerExpertise")
|
||||||
|
* Class SpeakerExpertise
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SpeakerExpertise extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Expertise", type="string")
|
||||||
|
*/
|
||||||
|
private $expertise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="areas_of_expertise")
|
||||||
|
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||||
|
* @var PresentationSpeaker
|
||||||
|
*/
|
||||||
|
private $speaker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getExpertise()
|
||||||
|
{
|
||||||
|
return $this->expertise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $expertise
|
||||||
|
*/
|
||||||
|
public function setExpertise($expertise)
|
||||||
|
{
|
||||||
|
$this->expertise = $expertise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PresentationSpeaker
|
||||||
|
*/
|
||||||
|
public function getSpeaker()
|
||||||
|
{
|
||||||
|
return $this->speaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationSpeaker $speaker
|
||||||
|
*/
|
||||||
|
public function setSpeaker($speaker)
|
||||||
|
{
|
||||||
|
$this->speaker = $speaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSpeakerId(){
|
||||||
|
try {
|
||||||
|
return !is_null($this->speaker) ? $this->speaker->getId() : 0;
|
||||||
|
}
|
||||||
|
catch(\Exception $ex){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
**/
|
||||||
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
|
use models\utils\SilverstripeBaseModel;
|
||||||
|
/**
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SpeakerLanguage")
|
||||||
|
* Class SpeakerLanguage
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SpeakerLanguage extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Language", type="string")
|
||||||
|
*/
|
||||||
|
private $language;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="languages")
|
||||||
|
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||||
|
* @var PresentationSpeaker
|
||||||
|
*/
|
||||||
|
private $speaker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLanguage()
|
||||||
|
{
|
||||||
|
return $this->language;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $language
|
||||||
|
*/
|
||||||
|
public function setLanguage($language)
|
||||||
|
{
|
||||||
|
$this->language = $language;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PresentationSpeaker
|
||||||
|
*/
|
||||||
|
public function getSpeaker()
|
||||||
|
{
|
||||||
|
return $this->speaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationSpeaker $speaker
|
||||||
|
*/
|
||||||
|
public function setSpeaker($speaker)
|
||||||
|
{
|
||||||
|
$this->speaker = $speaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSpeakerId(){
|
||||||
|
try {
|
||||||
|
return !is_null($this->speaker) ? $this->speaker->getId() : 0;
|
||||||
|
}
|
||||||
|
catch(\Exception $ex){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
**/
|
||||||
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
|
use models\utils\SilverstripeBaseModel;
|
||||||
|
/**
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SpeakerOrganizationalRole")
|
||||||
|
* Class SpeakerOrganizationalRole
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SpeakerOrganizationalRole extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Role", type="string")
|
||||||
|
*/
|
||||||
|
private $role;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="IsDefault", type="boolean")
|
||||||
|
*/
|
||||||
|
private $is_default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getRole()
|
||||||
|
{
|
||||||
|
return $this->role;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $role
|
||||||
|
*/
|
||||||
|
public function setRole($role)
|
||||||
|
{
|
||||||
|
$this->role = $role;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isDefault()
|
||||||
|
{
|
||||||
|
return $this->is_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $is_default
|
||||||
|
*/
|
||||||
|
public function setIsDefault($is_default)
|
||||||
|
{
|
||||||
|
$this->is_default = $is_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
**/
|
||||||
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
|
use models\utils\SilverstripeBaseModel;
|
||||||
|
/**
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SpeakerPresentationLink")
|
||||||
|
* Class SpeakerPresentationLink
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SpeakerPresentationLink extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="LinkUrl", type="string")
|
||||||
|
*/
|
||||||
|
private $link;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Title", type="string")
|
||||||
|
*/
|
||||||
|
private $title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="other_presentation_links")
|
||||||
|
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||||
|
* @var PresentationSpeaker
|
||||||
|
*/
|
||||||
|
private $speaker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLink()
|
||||||
|
{
|
||||||
|
return $this->link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $link
|
||||||
|
*/
|
||||||
|
public function setLink($link)
|
||||||
|
{
|
||||||
|
$this->link = $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTitle()
|
||||||
|
{
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $title
|
||||||
|
*/
|
||||||
|
public function setTitle($title)
|
||||||
|
{
|
||||||
|
$this->title = $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PresentationSpeaker
|
||||||
|
*/
|
||||||
|
public function getSpeaker()
|
||||||
|
{
|
||||||
|
return $this->speaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationSpeaker $speaker
|
||||||
|
*/
|
||||||
|
public function setSpeaker($speaker)
|
||||||
|
{
|
||||||
|
$this->speaker = $speaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSpeakerId(){
|
||||||
|
try {
|
||||||
|
return !is_null($this->speaker) ? $this->speaker->getId() : 0;
|
||||||
|
}
|
||||||
|
catch(\Exception $ex){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
**/
|
||||||
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
|
use models\utils\SilverstripeBaseModel;
|
||||||
|
/**
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SpeakerTravelPreference")
|
||||||
|
* Class SpeakerTravelPreference
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SpeakerTravelPreference extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Country", type="string")
|
||||||
|
*/
|
||||||
|
private $country;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="travel_preferences")
|
||||||
|
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||||
|
* @var PresentationSpeaker
|
||||||
|
*/
|
||||||
|
private $speaker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSpeakerId(){
|
||||||
|
try {
|
||||||
|
return !is_null($this->speaker) ? $this->speaker->getId() : 0;
|
||||||
|
}
|
||||||
|
catch(\Exception $ex){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCountry()
|
||||||
|
{
|
||||||
|
return $this->country;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $country
|
||||||
|
*/
|
||||||
|
public function setCountry($country)
|
||||||
|
{
|
||||||
|
$this->country = $country;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PresentationSpeaker
|
||||||
|
*/
|
||||||
|
public function getSpeaker()
|
||||||
|
{
|
||||||
|
return $this->speaker;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationSpeaker $speaker
|
||||||
|
*/
|
||||||
|
public function setSpeaker($speaker)
|
||||||
|
{
|
||||||
|
$this->speaker = $speaker;
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,8 @@
|
|||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use ModelSerializers\BaseSerializerTypeSelector;
|
||||||
|
use ModelSerializers\ISerializerTypeSelector;
|
||||||
use services\apis\EventbriteAPI;
|
use services\apis\EventbriteAPI;
|
||||||
use services\apis\FireBaseGCMApi;
|
use services\apis\FireBaseGCMApi;
|
||||||
/***
|
/***
|
||||||
@ -51,6 +53,8 @@ class ServicesProvider extends ServiceProvider
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
App::singleton(ISerializerTypeSelector::class, BaseSerializerTypeSelector::class);
|
||||||
|
|
||||||
App::singleton('services\model\ISummitService', 'services\model\SummitService');
|
App::singleton('services\model\ISummitService', 'services\model\SummitService');
|
||||||
|
|
||||||
App::singleton('services\model\ISpeakerService', 'services\model\SpeakerService');
|
App::singleton('services\model\ISpeakerService', 'services\model\SpeakerService');
|
||||||
|
@ -192,6 +192,15 @@ class ApiEndpointsSeeder extends Seeder
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'get-speaker',
|
'name' => 'get-speaker',
|
||||||
|
'route' => '/api/v1/speakers/{speaker_id}',
|
||||||
|
'http_method' => 'GET',
|
||||||
|
'scopes' => [
|
||||||
|
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
||||||
|
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'get-speaker-by-summit',
|
||||||
'route' => '/api/v1/summits/{id}/speakers/{speaker_id}',
|
'route' => '/api/v1/summits/{id}/speakers/{speaker_id}',
|
||||||
'http_method' => 'GET',
|
'http_method' => 'GET',
|
||||||
'scopes' => [
|
'scopes' => [
|
||||||
|
@ -167,7 +167,6 @@ class OAuth2SpeakersApiTest extends ProtectedApiTest
|
|||||||
return $speaker;
|
return $speaker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testGetCurrentSummitSpeakersOrderByID()
|
public function testGetCurrentSummitSpeakersOrderByID()
|
||||||
{
|
{
|
||||||
$params = [
|
$params = [
|
||||||
@ -273,6 +272,33 @@ class OAuth2SpeakersApiTest extends ProtectedApiTest
|
|||||||
"CONTENT_TYPE" => "application/json"
|
"CONTENT_TYPE" => "application/json"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$response = $this->action(
|
||||||
|
"GET",
|
||||||
|
"OAuth2SummitSpeakersApiController@getSummitSpeaker",
|
||||||
|
$params,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
$headers
|
||||||
|
);
|
||||||
|
|
||||||
|
$content = $response->getContent();
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
$speaker = json_decode($content);
|
||||||
|
$this->assertTrue(!is_null($speaker));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetSpeaker(){
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'speaker_id' => 1
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
||||||
|
"CONTENT_TYPE" => "application/json"
|
||||||
|
];
|
||||||
|
|
||||||
$response = $this->action(
|
$response = $this->action(
|
||||||
"GET",
|
"GET",
|
||||||
"OAuth2SummitSpeakersApiController@getSpeaker",
|
"OAuth2SummitSpeakersApiController@getSpeaker",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user