createEntites method
Creates model of tables
Implementation
String createEntites() {
print('createEntites() started');
final modelString = MyStringBuffer();
if (_m.databaseTables != null) {
modelString.writeln('// BEGIN ENTITIES');
for (var table in _m.databaseTables!) {
final fieldNames = StringBuffer();
for (final field in table.fields!) {
fieldNames.write('${field.fieldName},');
}
print(
'>>> ${table.objectType.toString().toUpperCase()} ${table.tableName}(${fieldNames.toString()}) converting to entity');
table.dbModel = _m.modelName;
modelString
// ..printToDebug('0: ${table.tableName}')
..writeln(SqfEntityObjectBuilder(table).toString())
// ..printToDebug('1: ${table.tableName}')
..writeln(SqfEntityObjectField(table).toString())
// ..printToDebug('2: ${table.tableName}')
..writeln(SqfEntityObjectFilterBuilder(table,
_m.formTables != null && _m.formTables!.contains(table))
.toString())
// ..printToDebug('3: ${table.tableName}')
..writeln(SqfEntityFieldBuilder(table).toString())
// ..printToDebug('4: ${table.tableName}')
..writeln(SqfEntityObjectManagerBuilder(table).toString());
}
}
if (_m.sequences != null) {
for (var sequence in _m.sequences!) {
modelString.writeln(
SqfEntitySequenceBuilder(sequence, _m.modelName!).toString());
}
}
modelString
..writeln(
'''class ${_m.modelName}SequenceManager extends SqfEntityProvider {
${_m.modelName}SequenceManager() : super(${_m.modelName}());
}''')
..writeln('// END OF ENTITIES');
print('SQFENTITY: [databaseTables] Model was created successfully. ');
return modelString.toString();
}