<commit_before><#include utilityPath + "all_imports.ftl" />
<#assign curr = entities[current_entity] />
<#assign fixtureType = options["fixture"].type />
<#assign hasDate = MetadataUtils.hasDate(curr) />
<#assign hasTime = MetadataUtils.hasTime(curr) />
<#assign hasDateTime = MetadataUtils.hasDateTime(curr) />
<#assign hasLocaleTime = MetadataUtils.hasLocaleTime(curr) />
<@header?interpret />

#import "${curr.name}.h"
#import "DateUtils.h"
${ImportUtils.importRelatedLoaders(curr, true)}

static NSString *FILE_NAME = @"${curr.name}";

@implementation ${curr.name}DataLoader

+ (instancetype) get${curr.name}DataLoader {
    static dispatch_once_t pred;
    static id shared = nil;

    dispatch_once(&pred, ^{
        shared = [super new];
    });

    return shared;
}

- (void) loadModel {
}

- (NSString *) getFixtureFileName {
    return FILE_NAME;
}

- (void) load:(DataManager *) dataManager {
    for(id key in self->items) {
        ${curr.name} *item = [self extractItem:[self->items objectForKey:key]];
        item.${curr_ids[0].name} = [dataManager persist:item];
    }
}

- (${curr.name} *) extractItem:(${curr.name} *) item {
    ${curr.name} *result = item;

<#list curr_fields as field>
    <#if (FieldsUtils.getObjectiveType(field)?lower_case == "datetime")>
    if ([item.${field.name} isKindOfClass:[NSString class]]) {
        result.${field.name} = [DateUtils fixtureStringToDateTime:(NSString *) item.${field.name}];
    }
    <#elseif (field.relation??)>
    if (item.${field.name} != nil) {
        result.${field.name} = [[[${field.relation.targetEntity}DataLoader get${field.relation.targetEntity}DataLoader] getItems] objectForKey:item.${field.name}];
    }
    </#if>
</#list>

    return result;
}


@end
<commit_msg>Update #7360, Handle the date in fixtures<commit_after><#include utilityPath + "all_imports.ftl" />
<#assign curr = entities[current_entity] />
<#assign fixtureType = options["fixture"].type />
<#assign hasDate = MetadataUtils.hasDate(curr) />
<#assign hasTime = MetadataUtils.hasTime(curr) />
<#assign hasDateTime = MetadataUtils.hasDateTime(curr) />
<#assign hasLocaleTime = MetadataUtils.hasLocaleTime(curr) />
<@header?interpret />

#import "${curr.name}.h"
#import "DateUtils.h"
${ImportUtils.importRelatedLoaders(curr, true)}

static NSString *FILE_NAME = @"${curr.name}";

@implementation ${curr.name}DataLoader

+ (instancetype) get${curr.name}DataLoader {
    static dispatch_once_t pred;
    static id shared = nil;

    dispatch_once(&pred, ^{
        shared = [super new];
    });

    return shared;
}

- (void) loadModel {
}

- (NSString *) getFixtureFileName {
    return FILE_NAME;
}

- (void) load:(DataManager *) dataManager {
    for(id key in self->items) {
        ${curr.name} *item = [self extractItem:[self->items objectForKey:key]];
        item.${curr_ids[0].name} = [dataManager persist:item];
    }
}

- (${curr.name} *) extractItem:(${curr.name} *) item {
    ${curr.name} *result = item;

<#list curr_fields as field>
    <#if (FieldsUtils.getObjectiveType(field)?lower_case == "datetime")>
    if ([item.${field.name} isKindOfClass:[NSString class]]) {
        if (((NSString *) item.${field.name}).length == 10) {
            result.${field.name} = [DateUtils fixtureStringToDate:(NSString *) item.${field.name}];
        } else {
            result.${field.name} = [DateUtils isoStringToDate:(NSString *) item.${field.name}];
        }
    }
    <#elseif (field.relation??)>
    if (item.${field.name} != nil) {
        result.${field.name} = [[[${field.relation.targetEntity}DataLoader get${field.relation.targetEntity}DataLoader] getItems] objectForKey:item.${field.name}];
    }
    </#if>
</#list>

    return result;
}


@end

{'fraction_non_alphanumeric': 0.1768506056527591, 'fraction_numerical': 0.0021534320323014803, 'mean_word_length': 4.028416779431664, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, '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': '5386251', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1227, 'n_words': 227}