<commit_before><?php

require '../Include/Config.php';
require '../Include/Functions.php';

use ChurchCRM\Service\GroupService;
use ChurchCRM\Service\SundaySchoolService;
use ChurchCRM\GroupQuery;
use ChurchCRM\dto\SystemConfig;

$groupService = new GroupService();
$sundaySchoolService = new SundaySchoolService();
$groups = GroupQuery::create()->find();

$colNames = [];
array_push($colNames, 'CRM ID');
array_push($colNames, 'FirstName');
array_push($colNames, 'LastName');
array_push($colNames, 'Email');
foreach ($groups as $group) {
    array_push($colNames, $group->getName());
}

$sundaySchoolsParents = [];
foreach ($groups as $group) {
    if ($group->isSundaySchool()) {
        $sundaySchoolParents = [];
        $kids = $sundaySchoolService->getKidsFullDetails($group->getId());
        $parentIds = [];
        foreach ($kids as $kid) {
            if ($kid['dadId'] != '') {
                array_push($parentIds, $kid['dadId']);
            }
            if ($kid['momId'] != '') {
                array_push($parentIds, $kid['momId']);
            }
        }
        $sundaySchoolsParents[$group['id']] = $parentIds;
    }
}

header('Content-type: text/csv');
header('Content-Disposition: attachment; filename=EmailExport-'.date(SystemConfig::getValue("sDateFilenameFormat")).'.csv');
header('Pragma: no-cache');
header('Expires: 0');

$out = fopen('php://output', 'w');
fputcsv($out, $colNames);
foreach ($personService->getPeopleEmailsAndGroups() as $person) {
    $row = [];
    array_push($row, $person['id']);
    array_push($row, $person['firstName']);
    array_push($row, $person['lastName']);
    array_push($row, $person['email']);<commit_msg>fixed bad ORM convert<commit_after><?php

require '../Include/Config.php';
require '../Include/Functions.php';

use ChurchCRM\Service\GroupService;
use ChurchCRM\Service\SundaySchoolService;
use ChurchCRM\GroupQuery;
use ChurchCRM\dto\SystemConfig;

$groupService = new GroupService();
$sundaySchoolService = new SundaySchoolService();
$groups = GroupQuery::create()->find();

$colNames = [];
array_push($colNames, 'CRM ID');
array_push($colNames, 'FirstName');
array_push($colNames, 'LastName');
array_push($colNames, 'Email');
foreach ($groups as $group) {
    array_push($colNames, $group->getName());
}

$sundaySchoolsParents = [];
foreach ($groups as $group) {
    if ($group->isSundaySchool()) {
        $sundaySchoolParents = [];
        $kids = $sundaySchoolService->getKidsFullDetails($group->getId());
        $parentIds = [];
        foreach ($kids as $kid) {
            if ($kid['dadId'] != '') {
                array_push($parentIds, $kid['dadId']);
            }
            if ($kid['momId'] != '') {
                array_push($parentIds, $kid['momId']);
            }
        }
        $sundaySchoolsParents[$group->getId()] = $parentIds;
    }
}

header('Content-type: text/csv');
header('Content-Disposition: attachment; filename=EmailExport-'.date(SystemConfig::getValue("sDateFilenameFormat")).'.csv');
header('Pragma: no-cache');
header('Expires: 0');

$out = fopen('php://output', 'w');
fputcsv($out, $colNames);
foreach ($personService->getPeopleEmailsAndGroups() as $person) {
    $row = [];
    array_push($row, $person['id']);
    array_push($row, $person['firstName']);
    array_push($row, $person['lastName']);
    array_push($row, $person['email']);
{'fraction_non_alphanumeric': 0.1938562481359976, 'fraction_numerical': 0.0005964807634953773, 'mean_word_length': 4.183925811437404, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4905333', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1047, 'n_words': 180}