20 lines
1.0 KiB
Twig
20 lines
1.0 KiB
Twig
{%- import '../../macroses/common.utils.twig' as utils -%}
|
|
|
|
public func copy{%- if hasChilds -%}{{ type.baseTypeName }}{%- endif -%}With({%- include '../class/nullable-parameters-fields.twig' with { fields: allFieldsOrdered } -%}) -> {{ type.baseTypeName }} {
|
|
return {{ type.baseTypeName }}({% include '../class/fields-optional-initialization.twig' with { fields: allFieldsOrdered } %})
|
|
}
|
|
|
|
{%- if allFieldsOrdered is not empty -%}
|
|
{%- for field in allFieldsOrdered -%}
|
|
{%- if field.nullable or field.optional -%}
|
|
{%- set containsOptionalFields = true -%}
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
{%- endif -%}
|
|
|
|
{% if containsOptionalFields %}
|
|
|
|
public func copy{%- if hasChilds -%}{{ type.baseTypeName }}{%- endif -%}Without({%- include '../class/bool-parameters-fields.twig' with { fields: allFieldsOrdered } -%}) -> {{ type.baseTypeName }} {
|
|
return {{ type.baseTypeName }}({%- include '../class/fields-without-initialization.twig' with { fields: allFieldsOrdered } -%})
|
|
}
|
|
{% endif %} |