Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Microsoft Graph DevX Tooling authored and Microsoft Graph DevX Tooling committed Nov 29, 2024
1 parent 32c2757 commit ea585a4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,12 @@ private void WriteFactoryMethodBodyForIntersectionModel(CodeMethod codeElement,
{
var deserializationMethodName = $"{ParseNodeVarName}->{GetDeserializationMethodName(propertyType, codeElement)}";
writer.StartBlock($"{(includeElse ? "} else " : string.Empty)}if ({deserializationMethodName} !== null) {{");
if(deserializationMethodName.Contains("getCollectionOfPrimitiveValues", StringComparison.Ordinal))
if (deserializationMethodName.Contains("getCollectionOfPrimitiveValues", StringComparison.Ordinal))
{
writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}(getStringValue());");
}
else
{
{
writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({deserializationMethodName});");
}

Expand Down Expand Up @@ -1011,7 +1011,14 @@ private void WriteFactoryMethodBodyForUnionModelForUnDiscriminatedTypes(CodeMeth
{
var serializationMethodName = $"{ParseNodeVarName}->{GetDeserializationMethodName(property.Type, currentElement)}";
writer.StartBlock($"{(includeElse ? "} else " : string.Empty)}if ({serializationMethodName} !== null) {{");
writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({serializationMethodName});");
if (serializationMethodName.Contains("getCollectionOfPrimitiveValues", StringComparison.Ordinal))
{
writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}(getStringValue());");
}
else
{
writer.WriteLine($"{ResultVarName}->{property.Setter!.Name.ToFirstCharacterLowerCase()}({serializationMethodName});");
}
writer.DecreaseIndent();
if (!includeElse)
includeElse = true;
Expand Down

0 comments on commit ea585a4

Please sign in to comment.