Added endpoints to get track groups by summit
GET /api/v1/summits/{id}/track-groups GET /api/v1/summits/{id}/track-groups/csv Filter * name (=@, ==) * description (=@, ==) * slug (=@, ==) * track_title (=@, ==) * track_code (=@, ==) * group_title (=@, ==) * group_code (=@, ==) * voting_visible (==) * chair_visible (==) * class_name (==) Order * id * name * slug Change-Id: Ib7c15a6c1bcbc328ce798ab459bb893fc2711f9c
This commit is contained in:
parent
75d969b81a
commit
4a98e4d3a2
@ -0,0 +1,290 @@
|
|||||||
|
<?php namespace App\Http\Controllers;
|
||||||
|
/**
|
||||||
|
* 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 App\Http\Utils\EpochCellFormatter;
|
||||||
|
use App\Http\Utils\PagingConstants;
|
||||||
|
use App\Models\Foundation\Summit\Events\Presentations\PresentationCategoryGroupConstants;
|
||||||
|
use App\Models\Foundation\Summit\Repositories\IPresentationCategoryGroupRepository;
|
||||||
|
use App\Services\Model\IPresentationCategoryGroupService;
|
||||||
|
use Illuminate\Support\Facades\Request;
|
||||||
|
use Illuminate\Support\Facades\Input;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use models\exceptions\ValidationException;
|
||||||
|
use models\oauth2\IResourceServerContext;
|
||||||
|
use models\summit\ISummitRepository;
|
||||||
|
use models\exceptions\EntityNotFoundException;
|
||||||
|
use ModelSerializers\SerializerRegistry;
|
||||||
|
use utils\Filter;
|
||||||
|
use utils\FilterParser;
|
||||||
|
use utils\OrderParser;
|
||||||
|
use utils\PagingInfo;
|
||||||
|
use Exception;
|
||||||
|
use utils\PagingResponse;
|
||||||
|
/**
|
||||||
|
* Class OAuth2PresentationCategoryGroupController
|
||||||
|
* @package App\Http\Controllers
|
||||||
|
*/
|
||||||
|
final class OAuth2PresentationCategoryGroupController
|
||||||
|
extends OAuth2ProtectedController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ISummitRepository
|
||||||
|
*/
|
||||||
|
private $summit_repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth2SummitsTicketTypesApiController constructor.
|
||||||
|
* @param IPresentationCategoryGroupRepository $repository
|
||||||
|
* @param ISummitRepository $summit_repository
|
||||||
|
* @param IPresentationCategoryGroupService $presentation_category_group_service
|
||||||
|
* @param IResourceServerContext $resource_server_context
|
||||||
|
*/
|
||||||
|
public function __construct
|
||||||
|
(
|
||||||
|
IPresentationCategoryGroupRepository $repository,
|
||||||
|
ISummitRepository $summit_repository,
|
||||||
|
IPresentationCategoryGroupService $presentation_category_group_service,
|
||||||
|
IResourceServerContext $resource_server_context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
parent::__construct($resource_server_context);
|
||||||
|
$this->repository = $repository;
|
||||||
|
$this->summit_repository = $summit_repository;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param $summit_id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getAllBySummit($summit_id){
|
||||||
|
$values = Input::all();
|
||||||
|
$rules = [
|
||||||
|
|
||||||
|
'page' => 'integer|min:1',
|
||||||
|
'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::DefaultPageSize, PagingConstants::MaxPageSize),
|
||||||
|
];
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
|
||||||
|
if (is_null($summit)) return $this->error404();
|
||||||
|
|
||||||
|
$validation = Validator::make($values, $rules);
|
||||||
|
|
||||||
|
if ($validation->fails()) {
|
||||||
|
$ex = new ValidationException();
|
||||||
|
throw $ex->setMessages($validation->messages()->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
// default values
|
||||||
|
$page = 1;
|
||||||
|
$per_page = PagingConstants::DefaultPageSize;
|
||||||
|
|
||||||
|
if (Input::has('page')) {
|
||||||
|
$page = intval(Input::get('page'));
|
||||||
|
$per_page = intval(Input::get('per_page'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter = null;
|
||||||
|
|
||||||
|
if (Input::has('filter')) {
|
||||||
|
$filter = FilterParser::parse(Input::get('filter'), [
|
||||||
|
'name' => ['=@', '=='],
|
||||||
|
'description' => ['=@', '=='],
|
||||||
|
'slug' => ['=@', '=='],
|
||||||
|
'track_title' => ['=@', '=='],
|
||||||
|
'track_code' => ['=@', '=='],
|
||||||
|
'group_title' => ['=@', '=='],
|
||||||
|
'group_code' => ['=@', '=='],
|
||||||
|
'voting_visible' => ['=='],
|
||||||
|
'chair_visible' => ['=='],
|
||||||
|
'class_name' => ['==']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_null($filter)) $filter = new Filter();
|
||||||
|
|
||||||
|
$filter->validate([
|
||||||
|
'name' => 'sometimes|string',
|
||||||
|
'description' => 'sometimes|string',
|
||||||
|
'slug' => 'sometimes|string',
|
||||||
|
'track_title' => 'sometimes|string',
|
||||||
|
'track_code' => 'sometimes|string',
|
||||||
|
'group_title' => 'sometimes|string',
|
||||||
|
'group_code' => 'sometimes|string',
|
||||||
|
'voting_visible' => 'sometimes|boolean',
|
||||||
|
'chair_visible' => 'sometimes|boolean',
|
||||||
|
'class_name' => sprintf('sometimes|in:%s', implode(',',PresentationCategoryGroupConstants::$valid_class_names)),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class_name.in' => sprintf
|
||||||
|
(
|
||||||
|
":attribute has an invalid value ( valid values are %s )",
|
||||||
|
implode(", ", PresentationCategoryGroupConstants::$valid_class_names)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$order = null;
|
||||||
|
|
||||||
|
if (Input::has('order'))
|
||||||
|
{
|
||||||
|
$order = OrderParser::parse(Input::get('order'), [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'slug'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||||
|
|
||||||
|
return $this->ok
|
||||||
|
(
|
||||||
|
$data->toArray
|
||||||
|
(
|
||||||
|
Request::input('expand', ''),
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (ValidationException $ex1)
|
||||||
|
{
|
||||||
|
Log::warning($ex1);
|
||||||
|
return $this->error412([$ex1->getMessage()]);
|
||||||
|
}
|
||||||
|
catch (EntityNotFoundException $ex2)
|
||||||
|
{
|
||||||
|
Log::warning($ex2);
|
||||||
|
return $this->error404(['message' => $ex2->getMessage()]);
|
||||||
|
}
|
||||||
|
catch(\HTTP401UnauthorizedException $ex3)
|
||||||
|
{
|
||||||
|
Log::warning($ex3);
|
||||||
|
return $this->error401();
|
||||||
|
}
|
||||||
|
catch (Exception $ex) {
|
||||||
|
Log::error($ex);
|
||||||
|
return $this->error500($ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $summit_id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getAllBySummitCSV($summit_id){
|
||||||
|
$values = Input::all();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
|
||||||
|
if (is_null($summit)) return $this->error404();
|
||||||
|
|
||||||
|
// default values
|
||||||
|
$page = 1;
|
||||||
|
$per_page = PHP_INT_MAX;
|
||||||
|
|
||||||
|
if (Input::has('page')) {
|
||||||
|
$page = intval(Input::get('page'));
|
||||||
|
$per_page = intval(Input::get('per_page'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter = null;
|
||||||
|
|
||||||
|
if (Input::has('filter')) {
|
||||||
|
$filter = FilterParser::parse(Input::get('filter'), [
|
||||||
|
'name' => ['=@', '=='],
|
||||||
|
'description' => ['=@', '=='],
|
||||||
|
'slug' => ['=@', '=='],
|
||||||
|
'track_title' => ['=@', '=='],
|
||||||
|
'track_code' => ['=@', '=='],
|
||||||
|
'group_title' => ['=@', '=='],
|
||||||
|
'group_code' => ['=@', '=='],
|
||||||
|
'voting_visible' => ['=='],
|
||||||
|
'chair_visible' => ['=='],
|
||||||
|
'class_name' => ['==']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_null($filter)) $filter = new Filter();
|
||||||
|
|
||||||
|
$filter->validate([
|
||||||
|
'name' => 'sometimes|string',
|
||||||
|
'description' => 'sometimes|string',
|
||||||
|
'slug' => 'sometimes|string',
|
||||||
|
'track_title' => 'sometimes|string',
|
||||||
|
'track_code' => 'sometimes|string',
|
||||||
|
'group_title' => 'sometimes|string',
|
||||||
|
'group_code' => 'sometimes|string',
|
||||||
|
'voting_visible' => 'sometimes|boolean',
|
||||||
|
'chair_visible' => 'sometimes|boolean',
|
||||||
|
'class_name' => sprintf('sometimes|in:%s', implode(',',PresentationCategoryGroupConstants::$valid_class_names)),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class_name.in' => sprintf
|
||||||
|
(
|
||||||
|
":attribute has an invalid value ( valid values are %s )",
|
||||||
|
implode(", ", PresentationCategoryGroupConstants::$valid_class_names)
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$order = null;
|
||||||
|
|
||||||
|
if (Input::has('order'))
|
||||||
|
{
|
||||||
|
$order = OrderParser::parse(Input::get('order'), [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'slug'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||||
|
|
||||||
|
$filename = "presentation-category-groups-" . date('Ymd');
|
||||||
|
$list = $data->toArray();
|
||||||
|
return $this->export
|
||||||
|
(
|
||||||
|
'csv',
|
||||||
|
$filename,
|
||||||
|
$list['data'],
|
||||||
|
[
|
||||||
|
'created' => new EpochCellFormatter,
|
||||||
|
'last_edited' => new EpochCellFormatter,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (ValidationException $ex1)
|
||||||
|
{
|
||||||
|
Log::warning($ex1);
|
||||||
|
return $this->error412(array( $ex1->getMessage()));
|
||||||
|
}
|
||||||
|
catch (EntityNotFoundException $ex2)
|
||||||
|
{
|
||||||
|
Log::warning($ex2);
|
||||||
|
return $this->error404(array('message' => $ex2->getMessage()));
|
||||||
|
}
|
||||||
|
catch(\HTTP401UnauthorizedException $ex3)
|
||||||
|
{
|
||||||
|
Log::warning($ex3);
|
||||||
|
return $this->error401();
|
||||||
|
}
|
||||||
|
catch (Exception $ex) {
|
||||||
|
Log::error($ex);
|
||||||
|
return $this->error500($ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -71,6 +71,9 @@ final class OAuth2SummitApiController extends OAuth2ProtectedController
|
|||||||
$this->service = $service;
|
$this->service = $service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getSummits()
|
public function getSummits()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -242,110 +245,6 @@ final class OAuth2SummitApiController extends OAuth2ProtectedController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $summit_id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTracks($summit_id){
|
|
||||||
try {
|
|
||||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
|
||||||
if (is_null($summit)) return $this->error404();
|
|
||||||
|
|
||||||
//tracks
|
|
||||||
$tracks = array();
|
|
||||||
foreach ($summit->getPresentationCategories() as $track)
|
|
||||||
{
|
|
||||||
$tracks[] = SerializerRegistry::getInstance()->getSerializer($track)->serialize(Request::input('expand', ''));
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = new PagingResponse
|
|
||||||
(
|
|
||||||
count($tracks),
|
|
||||||
count($tracks),
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
$tracks
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->ok($response->toArray());
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
Log::error($ex);
|
|
||||||
return $this->error500($ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $summit_id
|
|
||||||
* @param $track_id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTrack($summit_id, $track_id){
|
|
||||||
try {
|
|
||||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
|
||||||
if (is_null($summit)) return $this->error404();
|
|
||||||
|
|
||||||
$track = $summit->getPresentationCategory($track_id);
|
|
||||||
if (is_null($track)) return $this->error404();
|
|
||||||
|
|
||||||
return $this->ok(SerializerRegistry::getInstance()->getSerializer($track)->serialize(Request::input('expand', '')));
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
Log::error($ex);
|
|
||||||
return $this->error500($ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $summit_id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTracksGroups($summit_id){
|
|
||||||
try {
|
|
||||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
|
||||||
if (is_null($summit)) return $this->error404();
|
|
||||||
|
|
||||||
//track groups
|
|
||||||
$groups = array();
|
|
||||||
foreach ($summit->getCategoryGroups() as $group)
|
|
||||||
{
|
|
||||||
$groups[] = SerializerRegistry::getInstance()->getSerializer($group)->serialize(Request::input('expand', ''));
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = new PagingResponse
|
|
||||||
(
|
|
||||||
count($groups),
|
|
||||||
count($groups),
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
$groups
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->ok($response->toArray());
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
Log::error($ex);
|
|
||||||
return $this->error500($ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $summit_id
|
|
||||||
* @param $track_group_id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getTrackGroup($summit_id, $track_group_id){
|
|
||||||
try {
|
|
||||||
$summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id);
|
|
||||||
if (is_null($summit)) return $this->error404();
|
|
||||||
|
|
||||||
$group = $summit->getCategoryGroup($track_group_id);
|
|
||||||
if (is_null($group)) return $this->error404();
|
|
||||||
|
|
||||||
return $this->ok(SerializerRegistry::getInstance()->getSerializer($group)->serialize(Request::input('expand', '')));
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
Log::error($ex);
|
|
||||||
return $this->error500($ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $summit_id
|
* @param $summit_id
|
||||||
* @param $external_order_id
|
* @param $external_order_id
|
||||||
|
@ -15,7 +15,6 @@ use App\Http\Utils\EpochCellFormatter;
|
|||||||
use App\Http\Utils\PagingConstants;
|
use App\Http\Utils\PagingConstants;
|
||||||
use App\Services\Model\ISummitTicketTypeService;
|
use App\Services\Model\ISummitTicketTypeService;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
use App\Models\Foundation\Summit\Events\SummitEventTypeConstants;
|
|
||||||
use models\summit\ISummitTicketTypeRepository;
|
use models\summit\ISummitTicketTypeRepository;
|
||||||
use Illuminate\Support\Facades\Input;
|
use Illuminate\Support\Facades\Input;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
@ -484,8 +484,11 @@ Route::group([
|
|||||||
|
|
||||||
// track groups
|
// track groups
|
||||||
Route::group(['prefix' => 'track-groups'], function () {
|
Route::group(['prefix' => 'track-groups'], function () {
|
||||||
Route::get('', 'OAuth2SummitTracksApiController@getTracksGroups');
|
Route::get('', 'OAuth2PresentationCategoryGroupController@getAllBySummit');
|
||||||
Route::get('{track_group_id}', 'OAuth2SummitApiController@getTrackGroup');
|
Route::get('csv', 'OAuth2PresentationCategoryGroupController@getAllBySummitCSV');
|
||||||
|
Route::group(['prefix' => '{track_group_id}'], function () {
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// promo codes
|
// promo codes
|
||||||
|
@ -22,6 +22,8 @@ class PresentationCategoryGroupSerializer extends SilverStripeSerializer
|
|||||||
'Name' => 'name:json_string',
|
'Name' => 'name:json_string',
|
||||||
'Color' => 'color:json_string',
|
'Color' => 'color:json_string',
|
||||||
'Description' => 'description:json_string',
|
'Description' => 'description:json_string',
|
||||||
|
'ClassName' => 'class_name:json_string',
|
||||||
|
'SummitId' => 'summit_id:json_int',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,7 +33,7 @@ class PresentationCategoryGroupSerializer extends SilverStripeSerializer
|
|||||||
* @param array $params
|
* @param array $params
|
||||||
* @return array
|
* @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 = [] )
|
||||||
{
|
{
|
||||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||||
|
|
||||||
|
@ -11,9 +11,11 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
use Doctrine\Common\Collections\Criteria;
|
||||||
use Doctrine\ORM\Event\PreUpdateEventArgs;
|
use Doctrine\ORM\Event\PreUpdateEventArgs;
|
||||||
use Doctrine\ORM\Mapping AS ORM;
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
use Doctrine\ORM\Query\ResultSetMappingBuilder;
|
||||||
|
use models\main\Tag;
|
||||||
use models\utils\SilverstripeBaseModel;
|
use models\utils\SilverstripeBaseModel;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
/**
|
/**
|
||||||
@ -136,6 +138,7 @@ class PresentationCategory extends SilverstripeBaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @ORM\ManyToMany(targetEntity="models\summit\PresentationCategoryGroup", mappedBy="categories")
|
* @ORM\ManyToMany(targetEntity="models\summit\PresentationCategoryGroup", mappedBy="categories")
|
||||||
* @var PresentationCategoryGroup[]
|
* @var PresentationCategoryGroup[]
|
||||||
*/
|
*/
|
||||||
@ -154,8 +157,8 @@ class PresentationCategory extends SilverstripeBaseModel
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->groups = new ArrayCollection();
|
$this->groups = new ArrayCollection;
|
||||||
$this->allowed_tags = new ArrayCollection();
|
$this->allowed_tags = new ArrayCollection;
|
||||||
$this->session_count = 0;
|
$this->session_count = 0;
|
||||||
$this->alternate_count = 0;
|
$this->alternate_count = 0;
|
||||||
$this->lightning_alternate_count = 0;
|
$this->lightning_alternate_count = 0;
|
||||||
@ -179,6 +182,20 @@ class PresentationCategory extends SilverstripeBaseModel
|
|||||||
return $this->groups;
|
return $this->groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationCategoryGroup $group
|
||||||
|
*/
|
||||||
|
public function addToGroup(PresentationCategoryGroup $group){
|
||||||
|
$this->groups->add($group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationCategoryGroup $group
|
||||||
|
*/
|
||||||
|
public function removeFromGroup(PresentationCategoryGroup $group){
|
||||||
|
$this->groups->removeElement($group);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Tag[]
|
* @return Tag[]
|
||||||
*/
|
*/
|
||||||
@ -186,6 +203,25 @@ class PresentationCategory extends SilverstripeBaseModel
|
|||||||
return $this->allowed_tags;
|
return $this->allowed_tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $group_id
|
||||||
|
* @return PresentationCategoryGroup|null
|
||||||
|
*/
|
||||||
|
public function getGroupById($group_id){
|
||||||
|
$criteria = Criteria::create();
|
||||||
|
$criteria->where(Criteria::expr()->eq('id', intval($group_id)));
|
||||||
|
$res = $this->groups->matching($criteria)->first();
|
||||||
|
return $res === false ? null : $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $group_id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function belongsToGroup($group_id){
|
||||||
|
return $this->getGroupById($group_id) != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
@ -11,16 +11,20 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
use Doctrine\Common\Collections\Criteria;
|
||||||
use models\utils\SilverstripeBaseModel;
|
use models\utils\SilverstripeBaseModel;
|
||||||
use Doctrine\ORM\Mapping AS ORM;
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
/**
|
/**
|
||||||
* Class PresentationCategoryGroup
|
* Class PresentationCategoryGroup
|
||||||
* @ORM\Entity
|
* @ORM\Entity(repositoryClass="App\Repositories\Summit\DoctrinePresentationCategoryGroupRepository")
|
||||||
* @ORM\Table(name="PresentationCategoryGroup")
|
* @ORM\Table(name="PresentationCategoryGroup")
|
||||||
* @ORM\InheritanceType("JOINED")
|
* @ORM\InheritanceType("JOINED")
|
||||||
* @ORM\DiscriminatorColumn(name="ClassName", type="string")
|
* @ORM\DiscriminatorColumn(name="ClassName", type="string")
|
||||||
* @ORM\DiscriminatorMap({"PresentationCategoryGroup" = "PresentationCategoryGroup", "PrivatePresentationCategoryGroup" = "PrivatePresentationCategoryGroup"})
|
* @ORM\DiscriminatorMap({
|
||||||
|
* "PresentationCategoryGroup" = "PresentationCategoryGroup",
|
||||||
|
* "PrivatePresentationCategoryGroup" = "PrivatePresentationCategoryGroup"
|
||||||
|
* })
|
||||||
* @package models\summit
|
* @package models\summit
|
||||||
*/
|
*/
|
||||||
class PresentationCategoryGroup extends SilverstripeBaseModel
|
class PresentationCategoryGroup extends SilverstripeBaseModel
|
||||||
@ -103,6 +107,22 @@ class PresentationCategoryGroup extends SilverstripeBaseModel
|
|||||||
$this->summit = $summit;
|
$this->summit = $summit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSummitId(){
|
||||||
|
try {
|
||||||
|
return is_null($this->summit) ? 0 : $this->summit->getId();
|
||||||
|
}
|
||||||
|
catch(\Exception $ex){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clearSummit(){
|
||||||
|
$this->summit = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Summit
|
* @return Summit
|
||||||
*/
|
*/
|
||||||
@ -117,6 +137,7 @@ class PresentationCategoryGroup extends SilverstripeBaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* owning side
|
||||||
* @ORM\ManyToMany(targetEntity="models\summit\PresentationCategory", inversedBy="groups")
|
* @ORM\ManyToMany(targetEntity="models\summit\PresentationCategory", inversedBy="groups")
|
||||||
* @ORM\JoinTable(name="PresentationCategoryGroup_Categories",
|
* @ORM\JoinTable(name="PresentationCategoryGroup_Categories",
|
||||||
* joinColumns={@ORM\JoinColumn(name="PresentationCategoryGroupID", referencedColumnName="ID")},
|
* joinColumns={@ORM\JoinColumn(name="PresentationCategoryGroupID", referencedColumnName="ID")},
|
||||||
@ -134,4 +155,47 @@ class PresentationCategoryGroup extends SilverstripeBaseModel
|
|||||||
return $this->categories;
|
return $this->categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationCategory $track
|
||||||
|
*/
|
||||||
|
public function addCategory(PresentationCategory $track){
|
||||||
|
$track->addToGroup($this);
|
||||||
|
$this->categories[] = $track;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationCategory $track
|
||||||
|
*/
|
||||||
|
public function removeCategory(PresentationCategory $track){
|
||||||
|
$track->removeFromGroup($this);
|
||||||
|
$this->categories->removeElement($track);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $category_id
|
||||||
|
* @return PresentationCategory|null
|
||||||
|
*/
|
||||||
|
public function getCategoryById($category_id){
|
||||||
|
$criteria = Criteria::create();
|
||||||
|
$criteria->where(Criteria::expr()->eq('id', intval($category_id)));
|
||||||
|
$res = $this->categories->matching($criteria)->first();
|
||||||
|
return $res === false ? null : $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $category_id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasCategory($category_id){
|
||||||
|
return $this->getCategoryById($category_id) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ClassName = 'PresentationCategoryGroup';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getClassName(){
|
||||||
|
return self::ClassName;
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php namespace App\Models\Foundation\Summit\Events\Presentations;
|
||||||
|
/**
|
||||||
|
* 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\summit\PresentationCategoryGroup;
|
||||||
|
use models\summit\PrivatePresentationCategoryGroup;
|
||||||
|
/**
|
||||||
|
* Class PresentationCategoryGroupConstants
|
||||||
|
* @package App\Models\Foundation\Summit\Events\Presentations
|
||||||
|
*/
|
||||||
|
final class PresentationCategoryGroupConstants
|
||||||
|
{
|
||||||
|
public static $valid_class_names = [
|
||||||
|
PresentationCategoryGroup::ClassName,
|
||||||
|
PrivatePresentationCategoryGroup::ClassName,
|
||||||
|
];
|
||||||
|
}
|
@ -11,6 +11,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
use Doctrine\Common\Collections\Criteria;
|
||||||
use models\main\Group;
|
use models\main\Group;
|
||||||
use models\summit\PresentationCategoryGroup;
|
use models\summit\PresentationCategoryGroup;
|
||||||
use Doctrine\ORM\Mapping AS ORM;
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
@ -53,6 +54,41 @@ class PrivatePresentationCategoryGroup extends PresentationCategoryGroup
|
|||||||
*/
|
*/
|
||||||
protected $allowed_groups;
|
protected $allowed_groups;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Group $group
|
||||||
|
*/
|
||||||
|
public function addToGroup(Group $group){
|
||||||
|
if($this->allowed_groups->contains($group)) return;
|
||||||
|
$this->allowed_groups->add($group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Group $group
|
||||||
|
*/
|
||||||
|
public function removeFromGroup(Group $group){
|
||||||
|
if(!$this->allowed_groups->contains($group)) return;
|
||||||
|
$this->allowed_groups->removeElement($group);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $group_id
|
||||||
|
* @return Group|null
|
||||||
|
*/
|
||||||
|
public function getGroupById($group_id){
|
||||||
|
$criteria = Criteria::create();
|
||||||
|
$criteria->where(Criteria::expr()->eq('id', intval($group_id)));
|
||||||
|
$res = $this->allowed_groups->matching($criteria)->first();
|
||||||
|
return $res === false ? null : $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $group_id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function belongsToGroup($group_id){
|
||||||
|
return $this->getGroupById($group_id) != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@ -71,6 +107,12 @@ class PrivatePresentationCategoryGroup extends PresentationCategoryGroup
|
|||||||
return ($now >= $start_date && $now <= $end_date);
|
return ($now >= $start_date && $now <= $end_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->allowed_groups = new ArrayCollection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DateTime
|
* @return DateTime
|
||||||
*/
|
*/
|
||||||
@ -102,4 +144,13 @@ class PrivatePresentationCategoryGroup extends PresentationCategoryGroup
|
|||||||
{
|
{
|
||||||
return $this->allowed_groups;
|
return $this->allowed_groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ClassName = 'PrivatePresentationCategoryGroup';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getClassName(){
|
||||||
|
return self::ClassName;
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php namespace App\Models\Foundation\Summit\Repositories;
|
||||||
|
/**
|
||||||
|
* 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 IPresentationCategoryGroupRepository
|
||||||
|
* @package App\Models\Foundation\Summit\Repositories
|
||||||
|
*/
|
||||||
|
interface IPresentationCategoryGroupRepository extends ISummitOwnedEntityRepository
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -11,31 +11,12 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
use models\summit\Summit;
|
|
||||||
use models\utils\IBaseRepository;
|
|
||||||
use utils\Filter;
|
|
||||||
use utils\Order;
|
|
||||||
use utils\PagingInfo;
|
|
||||||
use utils\PagingResponse;
|
|
||||||
/**
|
/**
|
||||||
* Interface ISummitEventTypeRepository
|
* Interface ISummitEventTypeRepository
|
||||||
* @package App\Models\Foundation\Summit\Repositories
|
* @package App\Models\Foundation\Summit\Repositories
|
||||||
*/
|
*/
|
||||||
interface ISummitEventTypeRepository extends IBaseRepository
|
interface ISummitEventTypeRepository extends ISummitOwnedEntityRepository
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Summit $summit
|
|
||||||
* @param PagingInfo $paging_info
|
|
||||||
* @param Filter|null $filter
|
|
||||||
* @param Order|null $order
|
|
||||||
* @return PagingResponse
|
|
||||||
*/
|
|
||||||
public function getBySummit
|
|
||||||
(
|
|
||||||
Summit $summit,
|
|
||||||
PagingInfo $paging_info,
|
|
||||||
Filter $filter = null,
|
|
||||||
Order $order = null
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
@ -11,9 +11,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
use models\summit\Summit;
|
|
||||||
use models\summit\SummitAbstractLocation;
|
use models\summit\SummitAbstractLocation;
|
||||||
use models\utils\IBaseRepository;
|
|
||||||
use utils\Filter;
|
use utils\Filter;
|
||||||
use utils\Order;
|
use utils\Order;
|
||||||
use utils\PagingInfo;
|
use utils\PagingInfo;
|
||||||
@ -22,23 +20,8 @@ use utils\PagingResponse;
|
|||||||
* Interface ISummitLocationBannerRepository
|
* Interface ISummitLocationBannerRepository
|
||||||
* @package App\Models\Foundation\Summit\Repositories
|
* @package App\Models\Foundation\Summit\Repositories
|
||||||
*/
|
*/
|
||||||
interface ISummitLocationBannerRepository extends IBaseRepository
|
interface ISummitLocationBannerRepository extends ISummitOwnedEntityRepository
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Summit $summit
|
|
||||||
* @param PagingInfo $paging_info
|
|
||||||
* @param Filter|null $filter
|
|
||||||
* @param Order|null $order
|
|
||||||
* @return PagingResponse
|
|
||||||
*/
|
|
||||||
public function getBySummit
|
|
||||||
(
|
|
||||||
Summit $summit,
|
|
||||||
PagingInfo $paging_info,
|
|
||||||
Filter $filter = null,
|
|
||||||
Order $order = null
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SummitAbstractLocation $location
|
* @param SummitAbstractLocation $location
|
||||||
* @param PagingInfo $paging_info
|
* @param PagingInfo $paging_info
|
||||||
|
@ -12,32 +12,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
use models\summit\Summit;
|
use models\summit\Summit;
|
||||||
use models\utils\IBaseRepository;
|
|
||||||
use utils\Filter;
|
|
||||||
use utils\Order;
|
|
||||||
use utils\PagingInfo;
|
|
||||||
use utils\PagingResponse;
|
|
||||||
/**
|
/**
|
||||||
* Interface ISummitLocationRepository
|
* Interface ISummitLocationRepository
|
||||||
* @package App\Models\Foundation\Summit\Repositories
|
* @package App\Models\Foundation\Summit\Repositories
|
||||||
*/
|
*/
|
||||||
interface ISummitLocationRepository extends IBaseRepository
|
interface ISummitLocationRepository extends ISummitOwnedEntityRepository
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Summit $summit
|
|
||||||
* @param PagingInfo $paging_info
|
|
||||||
* @param Filter|null $filter
|
|
||||||
* @param Order|null $order
|
|
||||||
* @return PagingResponse
|
|
||||||
*/
|
|
||||||
public function getBySummit
|
|
||||||
(
|
|
||||||
Summit $summit,
|
|
||||||
PagingInfo $paging_info,
|
|
||||||
Filter $filter = null,
|
|
||||||
Order $order = null
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Summit $summit
|
* @param Summit $summit
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
<?php namespace App\Models\Foundation\Summit\Repositories;
|
||||||
|
/**
|
||||||
|
* 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\summit\Summit;
|
||||||
|
use models\utils\IBaseRepository;
|
||||||
|
use utils\Filter;
|
||||||
|
use utils\Order;
|
||||||
|
use utils\PagingInfo;
|
||||||
|
use utils\PagingResponse;
|
||||||
|
/**
|
||||||
|
* Interface ISummitOwnedEntityRepository
|
||||||
|
* @package App\Models\Foundation\Summit\Repositories
|
||||||
|
*/
|
||||||
|
interface ISummitOwnedEntityRepository extends IBaseRepository
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param Summit $summit
|
||||||
|
* @param PagingInfo $paging_info
|
||||||
|
* @param Filter|null $filter
|
||||||
|
* @param Order|null $order
|
||||||
|
* @return PagingResponse
|
||||||
|
*/
|
||||||
|
public function getBySummit
|
||||||
|
(
|
||||||
|
Summit $summit,
|
||||||
|
PagingInfo $paging_info,
|
||||||
|
Filter $filter = null,
|
||||||
|
Order $order = null
|
||||||
|
);
|
||||||
|
}
|
@ -11,33 +11,13 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
use models\utils\IBaseRepository;
|
use App\Models\Foundation\Summit\Repositories\ISummitOwnedEntityRepository;
|
||||||
use utils\Filter;
|
|
||||||
use utils\Order;
|
|
||||||
use utils\PagingInfo;
|
|
||||||
use utils\PagingResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface ISummitRegistrationPromoCodeRepository
|
* Interface ISummitRegistrationPromoCodeRepository
|
||||||
* @package models\summit
|
* @package models\summit
|
||||||
*/
|
*/
|
||||||
interface ISummitRegistrationPromoCodeRepository extends IBaseRepository
|
interface ISummitRegistrationPromoCodeRepository extends ISummitOwnedEntityRepository
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Summit $summit
|
|
||||||
* @param PagingInfo $paging_info
|
|
||||||
* @param Filter|null $filter
|
|
||||||
* @param Order|null $order
|
|
||||||
* @return PagingResponse
|
|
||||||
*/
|
|
||||||
public function getBySummit
|
|
||||||
(
|
|
||||||
Summit $summit,
|
|
||||||
PagingInfo $paging_info,
|
|
||||||
Filter $filter = null,
|
|
||||||
Order $order = null
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Summit $summit
|
* @param Summit $summit
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -11,29 +11,12 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
use models\utils\IBaseRepository;
|
use App\Models\Foundation\Summit\Repositories\ISummitOwnedEntityRepository;
|
||||||
use utils\Filter;
|
|
||||||
use utils\Order;
|
|
||||||
use utils\PagingInfo;
|
|
||||||
use utils\PagingResponse;
|
|
||||||
/**
|
/**
|
||||||
* Interface ISummitTicketTypeRepository
|
* Interface ISummitTicketTypeRepository
|
||||||
* @package models\summit
|
* @package models\summit
|
||||||
*/
|
*/
|
||||||
interface ISummitTicketTypeRepository extends IBaseRepository
|
interface ISummitTicketTypeRepository extends ISummitOwnedEntityRepository
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Summit $summit
|
|
||||||
* @param PagingInfo $paging_info
|
|
||||||
* @param Filter|null $filter
|
|
||||||
* @param Order|null $order
|
|
||||||
* @return PagingResponse
|
|
||||||
*/
|
|
||||||
public function getBySummit
|
|
||||||
(
|
|
||||||
Summit $summit,
|
|
||||||
PagingInfo $paging_info,
|
|
||||||
Filter $filter = null,
|
|
||||||
Order $order = null
|
|
||||||
);
|
|
||||||
}
|
}
|
@ -11,31 +11,11 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
use models\summit\Summit;
|
|
||||||
use models\utils\IBaseRepository;
|
|
||||||
use utils\Filter;
|
|
||||||
use utils\Order;
|
|
||||||
use utils\PagingInfo;
|
|
||||||
use utils\PagingResponse;
|
|
||||||
/**
|
/**
|
||||||
* Interface ISummitTrackRepository
|
* Interface ISummitTrackRepository
|
||||||
* @package App\Models\Foundation\Summit\Repositories
|
* @package App\Models\Foundation\Summit\Repositories
|
||||||
*/
|
*/
|
||||||
interface ISummitTrackRepository extends IBaseRepository
|
interface ISummitTrackRepository extends ISummitOwnedEntityRepository
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param Summit $summit
|
|
||||||
* @param PagingInfo $paging_info
|
|
||||||
* @param Filter|null $filter
|
|
||||||
* @param Order|null $order
|
|
||||||
* @return PagingResponse
|
|
||||||
*/
|
|
||||||
public function getBySummit
|
|
||||||
(
|
|
||||||
Summit $summit,
|
|
||||||
PagingInfo $paging_info,
|
|
||||||
Filter $filter = null,
|
|
||||||
Order $order = null
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
@ -43,7 +43,7 @@ trait SummitOwned
|
|||||||
*/
|
*/
|
||||||
public function getSummitId(){
|
public function getSummitId(){
|
||||||
try {
|
try {
|
||||||
return $this->summit->getId();
|
return is_null($this->summit) ? 0 : $this->summit->getId();
|
||||||
}
|
}
|
||||||
catch(\Exception $ex){
|
catch(\Exception $ex){
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -15,6 +15,7 @@ use App\Models\Foundation\Summit\Defaults\DefaultSummitEventType;
|
|||||||
use App\Models\Foundation\Summit\Events\RSVP\RSVPTemplate;
|
use App\Models\Foundation\Summit\Events\RSVP\RSVPTemplate;
|
||||||
use App\Models\Foundation\Summit\Locations\Banners\SummitLocationBanner;
|
use App\Models\Foundation\Summit\Locations\Banners\SummitLocationBanner;
|
||||||
use App\Models\Foundation\Summit\Repositories\IDefaultSummitEventTypeRepository;
|
use App\Models\Foundation\Summit\Repositories\IDefaultSummitEventTypeRepository;
|
||||||
|
use App\Models\Foundation\Summit\Repositories\IPresentationCategoryGroupRepository;
|
||||||
use App\Models\Foundation\Summit\Repositories\IPresentationSpeakerSummitAssistanceConfirmationRequestRepository;
|
use App\Models\Foundation\Summit\Repositories\IPresentationSpeakerSummitAssistanceConfirmationRequestRepository;
|
||||||
use App\Models\Foundation\Summit\Repositories\IRSVPTemplateRepository;
|
use App\Models\Foundation\Summit\Repositories\IRSVPTemplateRepository;
|
||||||
use App\Models\Foundation\Summit\Repositories\ISummitEventTypeRepository;
|
use App\Models\Foundation\Summit\Repositories\ISummitEventTypeRepository;
|
||||||
@ -34,6 +35,7 @@ use models\main\Organization;
|
|||||||
use models\summit\ISummitRegistrationPromoCodeRepository;
|
use models\summit\ISummitRegistrationPromoCodeRepository;
|
||||||
use models\summit\ISummitTicketTypeRepository;
|
use models\summit\ISummitTicketTypeRepository;
|
||||||
use models\summit\PresentationCategory;
|
use models\summit\PresentationCategory;
|
||||||
|
use models\summit\PresentationCategoryGroup;
|
||||||
use models\summit\PresentationSpeakerSummitAssistanceConfirmationRequest;
|
use models\summit\PresentationSpeakerSummitAssistanceConfirmationRequest;
|
||||||
use models\summit\SpeakerRegistrationRequest;
|
use models\summit\SpeakerRegistrationRequest;
|
||||||
use models\summit\SpeakerSummitRegistrationPromoCode;
|
use models\summit\SpeakerSummitRegistrationPromoCode;
|
||||||
@ -294,28 +296,35 @@ final class RepositoriesProvider extends ServiceProvider
|
|||||||
App::singleton(
|
App::singleton(
|
||||||
ISummitTrackRepository::class,
|
ISummitTrackRepository::class,
|
||||||
function(){
|
function(){
|
||||||
return EntityManager::getRepository(PresentationCategory::class);
|
return EntityManager::getRepository(PresentationCategory::class);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
App::singleton(
|
App::singleton(
|
||||||
IRSVPTemplateRepository::class,
|
IRSVPTemplateRepository::class,
|
||||||
function(){
|
function(){
|
||||||
return EntityManager::getRepository(RSVPTemplate::class);
|
return EntityManager::getRepository(RSVPTemplate::class);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
App::singleton(
|
App::singleton(
|
||||||
ISummitLocationRepository::class,
|
ISummitLocationRepository::class,
|
||||||
function(){
|
function(){
|
||||||
return EntityManager::getRepository(SummitAbstractLocation::class);
|
return EntityManager::getRepository(SummitAbstractLocation::class);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
App::singleton(
|
App::singleton(
|
||||||
ISummitLocationBannerRepository::class,
|
ISummitLocationBannerRepository::class,
|
||||||
function(){
|
function(){
|
||||||
return EntityManager::getRepository(SummitLocationBanner::class);
|
return EntityManager::getRepository(SummitLocationBanner::class);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
App::singleton(
|
||||||
|
IPresentationCategoryGroupRepository::class,
|
||||||
|
function(){
|
||||||
|
return EntityManager::getRepository(PresentationCategoryGroup::class);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,148 @@
|
|||||||
|
<?php namespace App\Repositories\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 App\Models\Foundation\Summit\Repositories\IPresentationCategoryGroupRepository;
|
||||||
|
use App\Repositories\SilverStripeDoctrineRepository;
|
||||||
|
use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||||
|
use models\summit\PresentationCategoryGroup;
|
||||||
|
use models\summit\PrivatePresentationCategoryGroup;
|
||||||
|
use models\summit\Summit;
|
||||||
|
use utils\DoctrineFilterMapping;
|
||||||
|
use utils\DoctrineInstanceOfFilterMapping;
|
||||||
|
use utils\Filter;
|
||||||
|
use utils\Order;
|
||||||
|
use utils\PagingInfo;
|
||||||
|
use utils\PagingResponse;
|
||||||
|
/**
|
||||||
|
* Class DoctrinePresentationCategoryGroupRepository
|
||||||
|
* @package App\Repositories\Summit
|
||||||
|
*/
|
||||||
|
final class DoctrinePresentationCategoryGroupRepository
|
||||||
|
extends SilverStripeDoctrineRepository
|
||||||
|
implements IPresentationCategoryGroupRepository
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getBaseEntity()
|
||||||
|
{
|
||||||
|
return PresentationCategoryGroup::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getFilterMappings()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'pcg.name:json_string',
|
||||||
|
'description' => 'pcg.description:json_string',
|
||||||
|
'slug' => 'pcg.slug:json_string',
|
||||||
|
'submission_begin_date' => 'ppcg.submission_begin_date:datetime_epoch',
|
||||||
|
'submission_end_date' => 'ppcg.submission_begin_date:datetime_epoch',
|
||||||
|
'class_name' => new DoctrineInstanceOfFilterMapping
|
||||||
|
(
|
||||||
|
"pcg",
|
||||||
|
[
|
||||||
|
PresentationCategoryGroup::ClassName => PresentationCategoryGroup::class,
|
||||||
|
PrivatePresentationCategoryGroup::ClassName => PrivatePresentationCategoryGroup::class,
|
||||||
|
]
|
||||||
|
),
|
||||||
|
'track_title' => new DoctrineFilterMapping
|
||||||
|
(
|
||||||
|
"(cat.title :operator ':value')"
|
||||||
|
),
|
||||||
|
'track_code' => new DoctrineFilterMapping
|
||||||
|
(
|
||||||
|
"(cat.code :operator ':value')"
|
||||||
|
),
|
||||||
|
'group_title' => new DoctrineFilterMapping
|
||||||
|
(
|
||||||
|
"(grp.title :operator ':value')"
|
||||||
|
),
|
||||||
|
'group_code' => new DoctrineFilterMapping
|
||||||
|
(
|
||||||
|
"(grp.code :operator ':value')"
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getOrderMappings()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => 'pcg.name',
|
||||||
|
'id' => 'pcg.id',
|
||||||
|
'slug' => 'pcg.slug',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Summit $summit
|
||||||
|
* @param PagingInfo $paging_info
|
||||||
|
* @param Filter|null $filter
|
||||||
|
* @param Order|null $order
|
||||||
|
* @return PagingResponse
|
||||||
|
*/
|
||||||
|
public function getBySummit
|
||||||
|
(
|
||||||
|
Summit $summit,
|
||||||
|
PagingInfo $paging_info,
|
||||||
|
Filter $filter = null,
|
||||||
|
Order $order = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$query = $this->getEntityManager()
|
||||||
|
->createQueryBuilder()
|
||||||
|
->select("pcg")
|
||||||
|
->from(PresentationCategoryGroup::class, "pcg")
|
||||||
|
->leftJoin(PrivatePresentationCategoryGroup::class, 'ppcg', 'WITH', 'ppcg.id = pcg.id')
|
||||||
|
->leftJoin("pcg.categories", "cat")
|
||||||
|
->leftJoin("ppcg.allowed_groups", "grp")
|
||||||
|
->leftJoin('pcg.summit', 's')
|
||||||
|
->where("s.id = :summit_id");
|
||||||
|
|
||||||
|
$query->setParameter("summit_id", $summit->getId());
|
||||||
|
|
||||||
|
if(!is_null($filter)){
|
||||||
|
$filter->apply2Query($query, $this->getFilterMappings());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($order)) {
|
||||||
|
$order->apply2Query($query, $this->getOrderMappings());
|
||||||
|
} else {
|
||||||
|
//default order
|
||||||
|
$query = $query->addOrderBy("pcg.id",'ASC');
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $query
|
||||||
|
->setFirstResult($paging_info->getOffset())
|
||||||
|
->setMaxResults($paging_info->getPerPage());
|
||||||
|
|
||||||
|
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
||||||
|
$total = $paginator->count();
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
foreach($paginator as $entity)
|
||||||
|
$data[] = $entity;
|
||||||
|
|
||||||
|
return new PagingResponse
|
||||||
|
(
|
||||||
|
$total,
|
||||||
|
$paging_info->getPerPage(),
|
||||||
|
$paging_info->getCurrentPage(),
|
||||||
|
$paging_info->getLastPage($total),
|
||||||
|
$data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
17
app/Services/Model/IPresentationCategoryGroupService.php
Normal file
17
app/Services/Model/IPresentationCategoryGroupService.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php namespace App\Services\Model;
|
||||||
|
/**
|
||||||
|
* 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 IPresentationCategoryGroupService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
24
app/Services/Model/PresentationCategoryGroupService.php
Normal file
24
app/Services/Model/PresentationCategoryGroupService.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php namespace App\Services\Model;
|
||||||
|
/**
|
||||||
|
* Copyright 2018 OpenStack Foundation
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PresentationCategoryGroupService
|
||||||
|
* @package App\Services\Model
|
||||||
|
*/
|
||||||
|
final class PresentationCategoryGroupService
|
||||||
|
extends AbstractService
|
||||||
|
implements IPresentationCategoryGroupService
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -19,10 +19,12 @@ use App\Services\Model\IAttendeeService;
|
|||||||
use App\Services\Model\IFolderService;
|
use App\Services\Model\IFolderService;
|
||||||
use App\Services\Model\ILocationService;
|
use App\Services\Model\ILocationService;
|
||||||
use App\Services\Model\IMemberService;
|
use App\Services\Model\IMemberService;
|
||||||
|
use App\Services\Model\IPresentationCategoryGroupService;
|
||||||
use App\Services\Model\IRSVPTemplateService;
|
use App\Services\Model\IRSVPTemplateService;
|
||||||
use App\Services\Model\ISummitEventTypeService;
|
use App\Services\Model\ISummitEventTypeService;
|
||||||
use App\Services\Model\ISummitTicketTypeService;
|
use App\Services\Model\ISummitTicketTypeService;
|
||||||
use App\Services\Model\ISummitTrackService;
|
use App\Services\Model\ISummitTrackService;
|
||||||
|
use App\Services\Model\PresentationCategoryGroupService;
|
||||||
use App\Services\Model\SummitLocationService;
|
use App\Services\Model\SummitLocationService;
|
||||||
use App\Services\Model\MemberService;
|
use App\Services\Model\MemberService;
|
||||||
use App\Services\Model\RSVPTemplateService;
|
use App\Services\Model\RSVPTemplateService;
|
||||||
@ -196,6 +198,12 @@ final class ServicesProvider extends ServiceProvider
|
|||||||
SummitTicketTypeService::class
|
SummitTicketTypeService::class
|
||||||
);
|
);
|
||||||
|
|
||||||
|
App::singleton
|
||||||
|
(
|
||||||
|
IPresentationCategoryGroupService::class,
|
||||||
|
PresentationCategoryGroupService::class
|
||||||
|
);
|
||||||
|
|
||||||
App::singleton(IGeoCodingAPI::class, function(){
|
App::singleton(IGeoCodingAPI::class, function(){
|
||||||
return new GoogleGeoCodingAPI
|
return new GoogleGeoCodingAPI
|
||||||
(
|
(
|
||||||
|
@ -1169,7 +1169,7 @@ class ApiEndpointsSeeder extends Seeder
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
// track groups
|
// track groups
|
||||||
array(
|
[
|
||||||
'name' => 'get-track-groups',
|
'name' => 'get-track-groups',
|
||||||
'route' => '/api/v1/summits/{id}/track-groups',
|
'route' => '/api/v1/summits/{id}/track-groups',
|
||||||
'http_method' => 'GET',
|
'http_method' => 'GET',
|
||||||
@ -1177,8 +1177,17 @@ class ApiEndpointsSeeder extends Seeder
|
|||||||
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
||||||
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
array(
|
[
|
||||||
|
'name' => 'get-track-groups-csv',
|
||||||
|
'route' => '/api/v1/summits/{id}/track-groups/csv',
|
||||||
|
'http_method' => 'GET',
|
||||||
|
'scopes' => [
|
||||||
|
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
||||||
|
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
'name' => 'get-track-group',
|
'name' => 'get-track-group',
|
||||||
'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}',
|
'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}',
|
||||||
'http_method' => 'GET',
|
'http_method' => 'GET',
|
||||||
@ -1186,7 +1195,7 @@ class ApiEndpointsSeeder extends Seeder
|
|||||||
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
||||||
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
//external orders
|
//external orders
|
||||||
array(
|
array(
|
||||||
'name' => 'get-external-order',
|
'name' => 'get-external-order',
|
||||||
|
@ -163,58 +163,6 @@ final class OAuth2SummitApiTest extends ProtectedApiTest
|
|||||||
$this->assertResponseStatus(200);
|
$this->assertResponseStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetTracks()
|
|
||||||
{
|
|
||||||
|
|
||||||
$params = array
|
|
||||||
(
|
|
||||||
'id' => 6,
|
|
||||||
'expand' => 'track_groups',
|
|
||||||
);
|
|
||||||
|
|
||||||
$headers = array("HTTP_Authorization" => " Bearer " . $this->access_token);
|
|
||||||
$response = $this->action(
|
|
||||||
"GET",
|
|
||||||
"OAuth2SummitApiController@getTracks",
|
|
||||||
$params,
|
|
||||||
array(),
|
|
||||||
array(),
|
|
||||||
array(),
|
|
||||||
$headers
|
|
||||||
);
|
|
||||||
|
|
||||||
$content = $response->getContent();
|
|
||||||
$tracks = json_decode($content);
|
|
||||||
$this->assertTrue(!is_null($tracks));
|
|
||||||
$this->assertResponseStatus(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetTrackGroups()
|
|
||||||
{
|
|
||||||
|
|
||||||
$params = array
|
|
||||||
(
|
|
||||||
'id' => 6,
|
|
||||||
'expand' => 'tracks',
|
|
||||||
);
|
|
||||||
|
|
||||||
$headers = array("HTTP_Authorization" => " Bearer " . $this->access_token);
|
|
||||||
$response = $this->action(
|
|
||||||
"GET",
|
|
||||||
"OAuth2SummitApiController@getTracksGroups",
|
|
||||||
$params,
|
|
||||||
array(),
|
|
||||||
array(),
|
|
||||||
array(),
|
|
||||||
$headers
|
|
||||||
);
|
|
||||||
|
|
||||||
$content = $response->getContent();
|
|
||||||
$groups = json_decode($content);
|
|
||||||
$this->assertTrue(!is_null($groups));
|
|
||||||
$this->assertResponseStatus(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetCurrentSummit($summit_id = 23)
|
public function testGetCurrentSummit($summit_id = 23)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
75
tests/OAuth2TrackGroupsApiTest.php
Normal file
75
tests/OAuth2TrackGroupsApiTest.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* 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 OAuth2TrackGroupsApiTest extends ProtectedApiTest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param int $summit_id
|
||||||
|
*/
|
||||||
|
public function testGetTrackGroups($summit_id = 23)
|
||||||
|
{
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'id' => $summit_id,
|
||||||
|
'expand' => 'tracks',
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = ["HTTP_Authorization" => " Bearer " . $this->access_token];
|
||||||
|
$response = $this->action(
|
||||||
|
"GET",
|
||||||
|
"OAuth2PresentationCategoryGroupController@getAllBySummit",
|
||||||
|
$params,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
$headers
|
||||||
|
);
|
||||||
|
|
||||||
|
$content = $response->getContent();
|
||||||
|
$track_groups = json_decode($content);
|
||||||
|
$this->assertTrue(!is_null($track_groups));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $summit_id
|
||||||
|
*/
|
||||||
|
public function testGetTrackGroupsPrivate($summit_id = 23)
|
||||||
|
{
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'id' => $summit_id,
|
||||||
|
'expand' => 'tracks',
|
||||||
|
'filter' => ['class_name=='.\models\summit\PrivatePresentationCategoryGroup::ClassName],
|
||||||
|
'order' => '+title',
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = ["HTTP_Authorization" => " Bearer " . $this->access_token];
|
||||||
|
$response = $this->action(
|
||||||
|
"GET",
|
||||||
|
"OAuth2PresentationCategoryGroupController@getAllBySummit",
|
||||||
|
$params,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
$headers
|
||||||
|
);
|
||||||
|
|
||||||
|
$content = $response->getContent();
|
||||||
|
$track_groups = json_decode($content);
|
||||||
|
$this->assertTrue(!is_null($track_groups));
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user