Services codegen is now a part of standard codegen
Publish PHP Package / docker (push) Successful in 7s Details

This commit is contained in:
Pavel Shevaev 2025-05-19 19:21:06 +03:00
parent 61ced3a581
commit f4f4d3bf27
3 changed files with 4 additions and 19 deletions

View File

@ -59,6 +59,8 @@ function codegen(?string $cache_dir, \mtgMetaInfo $meta, array $options = []) :
$output['factory.cs'] = $twig->render('codegen_factory.twig', $options);
$output['services.cs'] = codegen_services($cache_dir, filter_services_meta($meta), $options);
return $output;
}

View File

@ -19,10 +19,8 @@ static public class AutogenBundle
{
switch(class_id)
{
{%- for u in meta.getunits ~%}
{%- if u.object is instanceof('\\mtgMetaStruct')~%}
case {{u.object.classid}}: { return new {{u.object.name}}(); }
{%- endif ~%}
{%- for t in meta.factorytypes ~%}
case {{t.classid}}: { return new {{t.fullname}}(); }
{%- endfor ~%}
default:
{

View File

@ -21,21 +21,6 @@ public interface IRpc : metagen.IRpc
public static class Factory
{
public static IMetaStruct CreateById(uint class_id)
{
switch(class_id)
{
{%- for utype in obj.usertypes %}
{%- if utype is instanceof('\\mtgMetaStruct') ~%}
case {{utype.classid}}:
return new {{utype.name}}();
{% endif %}
{%- endfor ~%}
}
//fallback to global factory
return AutogenBundle.createById(class_id);
}
public static IRpc CreateRPC(int code)
{
switch(code)