/** * Formats an activity as a valid JSON object (with all the information about the activity) * @param ActivityEntity $activity * @return array */ public static function getFormattedData(ActivityEntity $activity) { $people = Person::getFormattedPeopleShortWithRecords($activity->getPeople()); $activityInfo = ['error' => null, 'id' => $activity->getId(), 'name' => $activity->getName(), 'target_groups' => TargetGroup::getFormattedTargetGroups($activity->getTargetGroup()), 'target_group_comment' => $activity->getTargetGroupComment(), 'start_date' => $activity->getStartDate()->format('Y-m-d H:i:s'), 'end_date' => $activity->getEndDate()->format('Y-m-d H:i:s'), 'participants' => $people]; return $activityInfo; }