Fixed member serializer
added all_affiliations expand Change-Id: I564f51cc3429021c72c555d3045db0c6c70fffea
This commit is contained in:
parent
bdd9e9b59c
commit
537eada594
|
@ -76,16 +76,6 @@ class AbstractMemberSerializer extends SilverStripeSerializer
|
|||
$values['affiliations'] = $res;
|
||||
}
|
||||
|
||||
if(in_array('all_affiliations', $relations)){
|
||||
$res = [];
|
||||
foreach ($member->getAllAffiliations() as $affiliation){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($affiliation)
|
||||
->serialize('organization');
|
||||
}
|
||||
$values['affiliations'] = $res;
|
||||
}
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
|
@ -110,6 +100,17 @@ class AbstractMemberSerializer extends SilverStripeSerializer
|
|||
$values['ccla_teams'] = $teams;
|
||||
}
|
||||
break;
|
||||
case 'all_affiliations':
|
||||
{
|
||||
$res = [];
|
||||
foreach ($member->getAllAffiliations() as $affiliation){
|
||||
$res[] = SerializerRegistry::getInstance()
|
||||
->getSerializer($affiliation)
|
||||
->serialize('organization');
|
||||
}
|
||||
$values['affiliations'] = $res;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class OAuth2AttendeesApiTest extends ProtectedApiTest
|
|||
$params = [
|
||||
'id' => 23,
|
||||
'attendee_id' => $attendee_id,
|
||||
'expand' => 'member,schedule,tickets,affiliations,groups,rsvp'
|
||||
'expand' => 'member,schedule,tickets,groups,rsvp,all_affiliations'
|
||||
];
|
||||
|
||||
$headers = [
|
||||
|
@ -114,7 +114,7 @@ class OAuth2AttendeesApiTest extends ProtectedApiTest
|
|||
'per_page' => 10,
|
||||
'order' => '+external_order_id',
|
||||
'filter' => 'external_order_id==615528547',
|
||||
'expand' => 'member,schedule,tickets,ticket_type'
|
||||
'expand' => 'member,schedule,tickets,ticket_type,all_affiliations'
|
||||
];
|
||||
|
||||
$headers = [
|
||||
|
|
Loading…
Reference in New Issue