Skip to content

Commit

Permalink
Add support for 'Group' and 'GroupContact'
Browse files Browse the repository at this point in the history
This is modeled on 'Event' and 'Participant'
  • Loading branch information
totten committed May 25, 2023
1 parent 148ccfc commit b877ce9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Pop/EntityDefault/Group.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields:
title: f.sentence,4
group_type: choose
2 changes: 2 additions & 0 deletions src/Pop/EntityDefault/GroupContact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
populators:
- groupId
7 changes: 7 additions & 0 deletions src/Pop/Populator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ function eventId($entity, &$fields){
$fields['event_id'] = $this->entityStore->getRandom('Event', array('is_template' => false))['id'];
}
}

function groupId($entity, &$fields) {
if(!isset($fields['group_id'])) {
$fields['group_id'] = $this->entityStore->getRandom('Group', array())['id'];
}
}

}

0 comments on commit b877ce9

Please sign in to comment.