Added private serializer for Speakers
Change-Id: I6c5faaeb45e36d3177809400ac744268f517f537
This commit is contained in:
parent
3d586f2924
commit
b2faf65f5a
@ -36,18 +36,18 @@ abstract class AbstractSerializer implements IModelSerializer
|
||||
|
||||
}
|
||||
|
||||
protected static $array_mappings = array();
|
||||
protected static $array_mappings = [];
|
||||
|
||||
protected static $allowed_fields = array();
|
||||
protected static $allowed_fields = [];
|
||||
|
||||
protected static $allowed_relations = array();
|
||||
protected static $allowed_relations = [];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getAllowedFields()
|
||||
{
|
||||
$mappings = array();
|
||||
$mappings = [];
|
||||
$hierarchy = $this->getClassHierarchy();
|
||||
|
||||
foreach($hierarchy as $class_name){
|
||||
@ -89,7 +89,7 @@ abstract class AbstractSerializer implements IModelSerializer
|
||||
*/
|
||||
private function getAttributeMappings()
|
||||
{
|
||||
$mappings = array();
|
||||
$mappings = [];
|
||||
$hierarchy = $this->getClassHierarchy();
|
||||
|
||||
foreach($hierarchy as $class_name){
|
||||
|
@ -19,6 +19,8 @@ use Illuminate\Support\Facades\Validator;
|
||||
use libs\utils\HTMLCleaner;
|
||||
use models\exceptions\EntityNotFoundException;
|
||||
use models\exceptions\ValidationException;
|
||||
use models\main\Group;
|
||||
use models\main\IMemberRepository;
|
||||
use models\oauth2\IResourceServerContext;
|
||||
use models\summit\IEventFeedbackRepository;
|
||||
use models\summit\ISpeakerRepository;
|
||||
@ -58,13 +60,29 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
||||
*/
|
||||
private $event_feedback_repository;
|
||||
|
||||
/**
|
||||
* @var IMemberRepository
|
||||
*/
|
||||
private $member_repository;
|
||||
|
||||
|
||||
/**
|
||||
* OAuth2SummitSpeakersApiController constructor.
|
||||
* @param ISummitRepository $summit_repository
|
||||
* @param ISummitEventRepository $event_repository
|
||||
* @param ISpeakerRepository $speaker_repository
|
||||
* @param IEventFeedbackRepository $event_feedback_repository
|
||||
* @param IMemberRepository $member_repository
|
||||
* @param ISpeakerService $service
|
||||
* @param IResourceServerContext $resource_server_context
|
||||
*/
|
||||
public function __construct
|
||||
(
|
||||
ISummitRepository $summit_repository,
|
||||
ISummitEventRepository $event_repository,
|
||||
ISpeakerRepository $speaker_repository,
|
||||
IEventFeedbackRepository $event_feedback_repository,
|
||||
IMemberRepository $member_repository,
|
||||
ISpeakerService $service,
|
||||
IResourceServerContext $resource_server_context
|
||||
) {
|
||||
@ -72,6 +90,7 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
||||
$this->repository = $summit_repository;
|
||||
$this->speaker_repository = $speaker_repository;
|
||||
$this->event_repository = $event_repository;
|
||||
$this->member_repository = $member_repository;
|
||||
$this->event_feedback_repository = $event_feedback_repository;
|
||||
$this->service = $service;
|
||||
}
|
||||
@ -87,8 +106,8 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
||||
public function getSpeakers($summit_id)
|
||||
{
|
||||
try {
|
||||
|
||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
||||
$serializer_type = SerializerRegistry::SerializerType_Public;
|
||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
||||
if (is_null($summit)) return $this->error404();
|
||||
|
||||
$values = Input::all();
|
||||
@ -140,17 +159,28 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
||||
));
|
||||
}
|
||||
|
||||
$current_member_id = $this->resource_server_context->getCurrentUserId();
|
||||
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);
|
||||
|
||||
return $this->ok
|
||||
(
|
||||
$result->toArray(Request::input('expand', ''),[],[],['summit_id' => $summit_id, 'published' => true])
|
||||
$result->toArray(Request::input('expand', ''),[],[],['summit_id' => $summit_id, 'published' => true, 'summit' => $summit], $serializer_type)
|
||||
);
|
||||
}
|
||||
catch(FilterParserException $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);
|
||||
@ -222,6 +252,11 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
||||
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);
|
||||
@ -238,16 +273,38 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
$serializer_type = SerializerRegistry::SerializerType_Public;
|
||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
||||
if (is_null($summit)) return $this->error404();
|
||||
|
||||
$speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check($speaker_id, $summit);
|
||||
if (is_null($speaker)) return $this->error404();
|
||||
|
||||
return $this->ok(SerializerRegistry::getInstance()->getSerializer($speaker)->serialize(Request::input('expand', '')));
|
||||
$current_member_id = $this->resource_server_context->getCurrentUserId();
|
||||
if(!is_null($current_member_id) && $member = $this->member_repository->getById($current_member_id)){
|
||||
if($member->isOnGroup(Group::SummitAdministrators)){
|
||||
$serializer_type = SerializerRegistry::SerializerType_Private;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $ex) {
|
||||
return $this->ok
|
||||
(
|
||||
SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize
|
||||
(
|
||||
Request::input('expand', ''),
|
||||
[],
|
||||
[],
|
||||
['summit_id' => $summit_id, 'published' => true, 'summit' => $summit]
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
catch(EntityNotFoundException $ex2)
|
||||
{
|
||||
Log::warning($ex2);
|
||||
return $this->error404(array('message'=> $ex2->getMessage()));
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
|
@ -101,27 +101,28 @@ final class PagingResponse
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @param string $serializer_type
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($expand = null, array $fields = [], array $relations = [], array $params = [] )
|
||||
public function toArray($expand = null, array $fields = [], array $relations = [], array $params = [], $serializer_type = SerializerRegistry::SerializerType_Public )
|
||||
{
|
||||
$items = [];
|
||||
foreach($this->items as $i)
|
||||
{
|
||||
if($i instanceof IEntity)
|
||||
{
|
||||
$i = SerializerRegistry::getInstance()->getSerializer($i)->serialize($expand, $fields, $relations, $params);
|
||||
$i = SerializerRegistry::getInstance()->getSerializer($i, $serializer_type)->serialize($expand, $fields, $relations, $params);
|
||||
}
|
||||
$items[] = $i;
|
||||
}
|
||||
|
||||
return array
|
||||
(
|
||||
return
|
||||
[
|
||||
'total' => $this->total,
|
||||
'per_page' => $this->per_page,
|
||||
'current_page' => $this->page,
|
||||
'last_page' => $this->last_page,
|
||||
'data' => $items,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
52
app/ModelSerializers/AdminPresentationSpeakerSerializer.php
Normal file
52
app/ModelSerializers/AdminPresentationSpeakerSerializer.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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);
|
||||
$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();
|
||||
}
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
}
|
@ -11,9 +11,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use models\summit\Presentation;
|
||||
use models\summit\PresentationSpeaker;
|
||||
|
||||
/**
|
||||
@ -22,20 +20,19 @@ use models\summit\PresentationSpeaker;
|
||||
*/
|
||||
class PresentationSpeakerSerializer extends SilverStripeSerializer
|
||||
{
|
||||
protected static $array_mappings = array
|
||||
(
|
||||
protected static $array_mappings = [
|
||||
|
||||
'FirstName' => 'first_name:json_string',
|
||||
'LastName' => 'last_name:json_string',
|
||||
'Title' => 'title:json_string',
|
||||
'Bio' => 'bio:json_string',
|
||||
'IRCHandle' => 'irc:json_string',
|
||||
'TwitterName' => 'twitter:json_string',
|
||||
);
|
||||
];
|
||||
|
||||
protected static $allowed_relations = array
|
||||
(
|
||||
protected static $allowed_relations = [
|
||||
'member',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
@ -44,7 +41,7 @@ class PresentationSpeakerSerializer extends SilverStripeSerializer
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
|
||||
public function serialize($expand = null, array $fields = [], array $relations = [], array $params = [] )
|
||||
{
|
||||
if(!count($relations)) $relations = $this->getAllowedRelations();
|
||||
|
||||
@ -55,8 +52,11 @@ class PresentationSpeakerSerializer extends SilverStripeSerializer
|
||||
|
||||
$summit_id = isset($params['summit_id'])? intval($params['summit_id']):null;
|
||||
$published = isset($params['published'])? intval($params['published']):true;
|
||||
$values['presentations'] = $speaker->getPresentationIds($summit_id, $published);
|
||||
$values['moderated_presentations'] = $speaker->getModeratedPresentationIds($summit_id, $published);
|
||||
if(!is_null($summit_id)) {
|
||||
$values['presentations'] = $speaker->getPresentationIds($summit_id, $published);
|
||||
$values['moderated_presentations'] = $speaker->getModeratedPresentationIds($summit_id, $published);
|
||||
}
|
||||
|
||||
$values['pic'] = Config::get("server.assets_base_url", 'https://www.openstack.org/') . 'profile_images/speakers/' . $speaker->getId();
|
||||
|
||||
if (in_array('member', $relations) && $speaker->hasMember())
|
||||
|
@ -0,0 +1,28 @@
|
||||
<?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.
|
||||
**/
|
||||
/**
|
||||
* Class PresentationSpeakerSummitAssistanceConfirmationRequestSerializer
|
||||
* @package ModelSerializers
|
||||
*/
|
||||
final class PresentationSpeakerSummitAssistanceConfirmationRequestSerializer extends SilverStripeSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'OnSitePhone' => 'on_site_phone:json_string',
|
||||
'Registered' => 'registered:json_boolean',
|
||||
'Confirmed' => 'is_confirmed:json_boolean',
|
||||
'CheckedIn' => 'checked_in:json_boolean',
|
||||
'SummitId' => 'summit_id:json_int',
|
||||
'SpeakerId' => 'speaker_id:json_int',
|
||||
];
|
||||
}
|
@ -37,6 +37,7 @@ use App\ModelSerializers\Marketplace\SupportChannelTypeSerializer;
|
||||
use App\ModelSerializers\Software\OpenStackComponentSerializer;
|
||||
use App\ModelSerializers\Software\OpenStackReleaseSerializer;
|
||||
use Libs\ModelSerializers\IModelSerializer;
|
||||
use models\summit\SummitRegistrationPromoCode;
|
||||
use ModelSerializers\ChatTeams\ChatTeamInvitationSerializer;
|
||||
use ModelSerializers\ChatTeams\ChatTeamMemberSerializer;
|
||||
use ModelSerializers\ChatTeams\ChatTeamPushNotificationMessageSerializer;
|
||||
@ -98,14 +99,23 @@ final class SerializerRegistry
|
||||
$this->registry['PresentationSlide'] = PresentationSlideSerializer::class;
|
||||
$this->registry['PresentationLink'] = PresentationLinkSerializer::class;
|
||||
$this->registry['Company'] = CompanySerializer::class;
|
||||
$this->registry['PresentationSpeaker'] = PresentationSpeakerSerializer::class;
|
||||
$this->registry['SummitEventFeedback'] = SummitEventFeedbackSerializer::class;
|
||||
$this->registry['SummitAttendee'] = SummitAttendeeSerializer::class;
|
||||
$this->registry['SummitMemberSchedule'] = SummitMemberScheduleSerializer::class;
|
||||
$this->registry['SummitMemberFavorite'] = SummitMemberFavoriteSerializer::class;
|
||||
$this->registry['SummitEntityEvent'] = SummitEntityEventSerializer::class;
|
||||
$this->registry['SummitEventWithFile'] = SummitEventWithFileSerializer::class;
|
||||
$this->registry['SummitScheduleEmptySpot'] = SummitScheduleEmptySpotSerializer::class;
|
||||
|
||||
$this->registry['PresentationSpeaker'] =
|
||||
[
|
||||
self::SerializerType_Public => PresentationSpeakerSerializer::class,
|
||||
self::SerializerType_Private => AdminPresentationSpeakerSerializer::class
|
||||
];
|
||||
|
||||
$this->registry['SummitEventFeedback'] = SummitEventFeedbackSerializer::class;
|
||||
$this->registry['SummitAttendee'] = SummitAttendeeSerializer::class;
|
||||
$this->registry['SummitMemberSchedule'] = SummitMemberScheduleSerializer::class;
|
||||
$this->registry['SummitMemberFavorite'] = SummitMemberFavoriteSerializer::class;
|
||||
$this->registry['SummitEntityEvent'] = SummitEntityEventSerializer::class;
|
||||
$this->registry['SummitEventWithFile'] = SummitEventWithFileSerializer::class;
|
||||
$this->registry['SummitScheduleEmptySpot'] = SummitScheduleEmptySpotSerializer::class;
|
||||
$this->registry['SummitRegistrationPromoCode'] = SummitRegistrationPromoCodeSerializer::class;
|
||||
$this->registry['SpeakerSummitRegistrationPromoCode'] = SpeakerSummitRegistrationPromoCodeSerializer::class;
|
||||
$this->registry['PresentationSpeakerSummitAssistanceConfirmationRequest'] = PresentationSpeakerSummitAssistanceConfirmationRequestSerializer::class;
|
||||
// locations
|
||||
$this->registry['SummitVenue'] = SummitVenueSerializer::class;
|
||||
$this->registry['SummitVenueRoom'] = SummitVenueRoomSerializer::class;
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?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.
|
||||
**/
|
||||
/**
|
||||
* Class SpeakerSummitRegistrationPromoCodeSerializer
|
||||
* @package ModelSerializers
|
||||
*/
|
||||
final class SpeakerSummitRegistrationPromoCodeSerializer
|
||||
extends SummitRegistrationPromoCodeSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'Type' => 'type:json_string',
|
||||
'SpeakerId' => 'speaker_id:json_int',
|
||||
];
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?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.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Class SummitRegistrationPromoCodeSerializer
|
||||
* @package ModelSerializers
|
||||
*/
|
||||
class SummitRegistrationPromoCodeSerializer extends SilverStripeSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'Code' => 'code:json_string',
|
||||
'Redeemed' => 'redeemed:json_boolean',
|
||||
'Source' => 'source:json_string',
|
||||
'SummitId' => 'summit_id:json_int',
|
||||
];
|
||||
}
|
@ -27,6 +27,7 @@ class Group extends SilverstripeBaseModel
|
||||
const AdminGroupCode = 'administrators';
|
||||
const CommunityMembersCode = 'community-members';
|
||||
const FoundationMembersCode = 'foundation-members';
|
||||
const SummitAdministrators = 'summit-front-end-administrators';
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
|
@ -582,12 +582,41 @@ class Member extends SilverstripeBaseModel
|
||||
*/
|
||||
public function isAdmin()
|
||||
{
|
||||
$admin_group = $this->getGroupByCode(Group::AdminGroupCode);
|
||||
return $admin_group != false && !is_null($admin_group);
|
||||
}
|
||||
|
||||
$admin_group = $this->groups->filter(function ($entity) {
|
||||
return $entity->getCode() == Group::AdminGroupCode;
|
||||
/**
|
||||
* @param string $code
|
||||
* @return bool
|
||||
*/
|
||||
public function isOnGroup($code){
|
||||
if($this->isAdmin()) return true;
|
||||
$group = $this->getGroupByCode($code);
|
||||
return $group != false && !is_null($group);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @return Group|null
|
||||
*/
|
||||
public function getGroupByCode($code){
|
||||
/**
|
||||
*
|
||||
* this is the rite way to do it but due a bug that will
|
||||
* be fixed on doctrine 2.6 (https://github.com/doctrine/doctrine2/pull/1399)this
|
||||
* should be carried on on following
|
||||
* way
|
||||
* $criteria = Criteria::create();
|
||||
* $criteria->where(Criteria::expr()->eq('code', $code));
|
||||
* return $this->groups->matching($criteria)->first();
|
||||
*/
|
||||
|
||||
$groups = $this->groups->filter(function ($entity) use($code){
|
||||
return $entity->getCode() == $code;
|
||||
});
|
||||
|
||||
return !is_null($admin_group) && $admin_group != false && $admin_group->count() > 0;
|
||||
return !is_null($groups) && $groups != false && $groups->count() > 0 ? $groups[0]: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -245,6 +245,16 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Summit $summit
|
||||
* @return SpeakerSummitRegistrationPromoCode
|
||||
*/
|
||||
public function getPromoCodeFor(Summit $summit){
|
||||
$criteria = Criteria::create();
|
||||
$criteria->where(Criteria::expr()->eq('summit', $summit));
|
||||
return $this->promo_codes->matching($criteria)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|int $summit_id
|
||||
* @param bool|true $published_ones
|
||||
|
@ -52,12 +52,6 @@ class PresentationSpeakerSummitAssistanceConfirmationRequest extends Silverstrip
|
||||
*/
|
||||
private $speaker;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Summit")
|
||||
* @ORM\JoinColumn(name="SummitID", referencedColumnName="ID")
|
||||
* @var Summit
|
||||
*/
|
||||
private $summit;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
@ -139,19 +133,17 @@ class PresentationSpeakerSummitAssistanceConfirmationRequest extends Silverstrip
|
||||
$this->speaker = $speaker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Summit
|
||||
*/
|
||||
public function getSummit()
|
||||
{
|
||||
return $this->summit;
|
||||
}
|
||||
use SummitOwned;
|
||||
|
||||
/**
|
||||
* @param Summit $summit
|
||||
* @return int
|
||||
*/
|
||||
public function setSummit($summit)
|
||||
{
|
||||
$this->summit = $summit;
|
||||
public function getSpeakerId(){
|
||||
try {
|
||||
return !is_null($this->speaker) ? $this->speaker->getId() : 0;
|
||||
}
|
||||
catch(\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -70,4 +70,16 @@ class SpeakerSummitRegistrationPromoCode extends SummitRegistrationPromoCode
|
||||
parent::__construct();
|
||||
$this->redeemed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSpeakerId(){
|
||||
try {
|
||||
return !is_null($this->speaker) ? $this->speaker->getId() : 0;
|
||||
}
|
||||
catch(\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -216,10 +216,9 @@ final class OAuth2SummitApiTest extends ProtectedApiTest
|
||||
{
|
||||
$params = [
|
||||
|
||||
'id' => 'current',
|
||||
'id' => 23,
|
||||
'page' => 1,
|
||||
'per_page' => 15,
|
||||
'filter' => 'first_name=@John,last_name=@Bryce,email=@sebastian@',
|
||||
'per_page' => 50,
|
||||
'order' => '+first_name,-last_name'
|
||||
];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user