adeed more order fields
[+|-] location ( location.name) [+|-] track ( track.title) Change-Id: I1a4e507b56d958c36327aa5fc8584705ac03bd17
This commit is contained in:
parent
87e99197ed
commit
6b528c34a4
@ -36,6 +36,7 @@ abstract class RetrieveSummitEventsStrategy
|
||||
$page = intval(Input::get('page'));
|
||||
$per_page = intval(Input::get('per_page'));
|
||||
}
|
||||
|
||||
return [$page, $per_page];
|
||||
}
|
||||
|
||||
@ -94,6 +95,7 @@ abstract class RetrieveSummitEventsStrategy
|
||||
'end_date',
|
||||
'id',
|
||||
'created',
|
||||
'track',
|
||||
]);
|
||||
}
|
||||
return $order;
|
||||
|
@ -13,7 +13,6 @@
|
||||
**/
|
||||
use App\Models\Foundation\Main\IGroup;
|
||||
use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
use models\main\Group;
|
||||
use models\summit\ISummitEventRepository;
|
||||
use models\summit\SummitEvent;
|
||||
use App\Repositories\SilverStripeDoctrineRepository;
|
||||
@ -28,7 +27,6 @@ use utils\PagingResponse;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use utils\DoctrineLeftJoinFilterMapping;
|
||||
use models\summit\SummitGroupEvent;
|
||||
use models\summit\Presentation;
|
||||
/**
|
||||
* Class DoctrineSummitEventRepository
|
||||
* @package App\Repositories\Summit
|
||||
@ -175,6 +173,8 @@ final class DoctrineSummitEventRepository
|
||||
'start_date' => 'e.start_date',
|
||||
'end_date' => 'e.end_date',
|
||||
'created' => 'e.created',
|
||||
'track' => 'cc.title',
|
||||
'location' => 'l.name',
|
||||
];
|
||||
}
|
||||
|
||||
@ -195,7 +195,10 @@ final class DoctrineSummitEventRepository
|
||||
|
||||
$query = $this->getEntityManager()->createQueryBuilder()
|
||||
->select("e")
|
||||
->from($class, "e")->leftJoin("e.location", 'l', Join::LEFT_JOIN);
|
||||
->from($class, "e")
|
||||
->leftJoin("e.location", 'l', Join::LEFT_JOIN)
|
||||
->leftJoin("e.category", 'cc', Join::LEFT_JOIN)
|
||||
;
|
||||
|
||||
if(!is_null($filter)){
|
||||
$filter->apply2Query($query, $this->getFilterMappings());
|
||||
@ -210,8 +213,6 @@ final class DoctrineSummitEventRepository
|
||||
}
|
||||
|
||||
if($class == \models\summit\Presentation::class) {
|
||||
$query = $query->innerJoin("e.category", "cc", Join::WITH);
|
||||
$query = $query->leftJoin("e.location", "loc", Join::WITH);
|
||||
$query = $query->leftJoin("e.speakers", "sp", Join::WITH);
|
||||
$query = $query->leftJoin('e.selected_presentations', "ssp", Join::LEFT_JOIN);
|
||||
$query = $query->leftJoin('ssp.list', "sspl", Join::LEFT_JOIN);
|
||||
@ -291,6 +292,7 @@ final class DoctrineSummitEventRepository
|
||||
->select("e")
|
||||
->from($class, "e")
|
||||
->leftJoin("e.location", 'l', Join::LEFT_JOIN)
|
||||
->leftJoin("e.category", 'cc', Join::LEFT_JOIN)
|
||||
->where("l.id is null");
|
||||
|
||||
if(!is_null($filter)){
|
||||
@ -306,7 +308,6 @@ final class DoctrineSummitEventRepository
|
||||
}
|
||||
|
||||
if($class == \models\summit\Presentation::class) {
|
||||
$query = $query->innerJoin("e.category", "cc", Join::WITH);
|
||||
$query = $query->leftJoin("e.speakers", "sp", Join::WITH);
|
||||
$query = $query->leftJoin('e.selected_presentations', "ssp", Join::LEFT_JOIN);
|
||||
$query = $query->leftJoin('ssp.list', "sspl", Join::LEFT_JOIN);
|
||||
@ -315,7 +316,6 @@ final class DoctrineSummitEventRepository
|
||||
$query = $query->leftJoin('sp.registration_request', "sprr", Join::LEFT_JOIN);
|
||||
}
|
||||
|
||||
|
||||
$can_view_private_events = self::isCurrentMemberOnGroup(IGroup::SummitAdministrators);
|
||||
|
||||
if(!$can_view_private_events){
|
||||
|
@ -887,6 +887,39 @@ final class OAuth2SummitEventsApiTest extends ProtectedApiTest
|
||||
$this->assertTrue(!is_null($events));
|
||||
}
|
||||
|
||||
public function testGetUnpublishedEventBySummitOrderByTrack($summit_id=26)
|
||||
{
|
||||
$params = [
|
||||
|
||||
'id' => $summit_id,
|
||||
'order' => '+track',
|
||||
'expand' => 'speakers',
|
||||
];
|
||||
|
||||
$headers = [
|
||||
|
||||
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
||||
"CONTENT_TYPE" => "application/json"
|
||||
];
|
||||
|
||||
$response = $this->action
|
||||
(
|
||||
"GET",
|
||||
"OAuth2SummitEventsApiController@getUnpublishedEvents",
|
||||
$params,
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
$headers
|
||||
);
|
||||
|
||||
$content = $response->getContent();
|
||||
$this->assertResponseStatus(200);
|
||||
|
||||
$events = json_decode($content);
|
||||
$this->assertTrue(!is_null($events));
|
||||
}
|
||||
|
||||
public function testGetAllScheduledEventsUsingOrder()
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user