Skip to content

Commit 61c95c3

Browse files
author
Caitlin Bales (MSFT)
committed
Fix inheritance and remove duplicate getters
1 parent 476dce5 commit 61c95c3

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

Templates/PHP/Model/ComplexType.php.tt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,11 @@ namespace Microsoft\Graph\Model;
1212
<#=writer.GetClassBlock(complex.Name.ToCheckedCase().ToString(), "Model")#>
1313
class <#=complex.Name.ToCheckedCase()#> extends Entity
1414
{
15-
/**
16-
* Gets the property dictionary of the <#=complex.Name.ToCheckedCase()#>
17-
*
18-
* @return array The list of properties
19-
*/
20-
public function getProperties()
21-
{
22-
return $this->_propDict;
23-
}
2415
<#
2516
foreach(var property in complex.Properties.Where(prop => prop.Type.GetTypeString() != "bytes")){
2617
var propertyName = property.Name.ToUnderscore();
2718
if (!property.Type.IsComplex()) {
2819
#>
29-
3020
/**
3121
* Gets the <#=property.Name#>
3222
*

Templates/PHP/Model/EntityType.php.tt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class <#=entity.Name.ToCheckedCase()#> implements \JsonSerializable
2020
<#
2121
} else {
2222
#>
23-
class <#=entity.Name.ToCheckedCase()#> extends Entity
23+
class <#=entity.Name.ToCheckedCase()#> extends <#=entity.Base.Name.ToCheckedCase() #>
2424
<#
2525
}
2626
#>
@@ -45,9 +45,7 @@ if (entity.Name.ToCheckedCase() == "Entity") {
4545
{
4646
$this->_propDict = $propDict;
4747
}
48-
<#
49-
}
50-
#>
48+
5149
/**
5250
* Gets the property dictionary of the <#=entity.Name.ToUpperFirstChar()#>
5351
*
@@ -57,14 +55,15 @@ if (entity.Name.ToCheckedCase() == "Entity") {
5755
{
5856
return $this->_propDict;
5957
}
60-
<#
58+
59+
<#
60+
}
6161
foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString() != "bytes")){
6262
var propertyName = property.Name.ToUnderscore();
6363
var propertyNameCap = property.Name.ToUpperFirstChar();
6464
if (property.Type.IsComplex()) {
6565
if (property.IsCollection()) {
6666
#>
67-
6867
/**
6968
* Gets the <#=property.Name#>
7069
*
@@ -78,7 +77,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
7877
return null;
7978
}
8079
}
81-
80+
8281
/**
8382
* Sets the <#=property.Name#>
8483
*
@@ -91,11 +90,10 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
9190
$this->_propDict["<#=property.Name.ToCamelize()#>"] = $val;
9291
return $this;
9392
}
94-
93+
9594
<#
9695
} else {
9796
#>
98-
9997
/**
10098
* Gets the <#=property.Name#>
10199
*
@@ -113,7 +111,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
113111
}
114112
return null;
115113
}
116-
114+
117115
/**
118116
* Sets the <#=property.Name#>
119117
*
@@ -132,11 +130,11 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
132130
<# } #>
133131
return $this;
134132
}
133+
135134
<#
136135
}
137136
} else {
138137
#>
139-
140138
/**
141139
* Gets the <#=property.Name#>
142140
*
@@ -160,7 +158,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
160158
return null;
161159
}
162160
}
163-
161+
164162
/**
165163
* Sets the <#=property.Name#>
166164
*
@@ -190,6 +188,7 @@ foreach(var property in entity.Properties.Where(prop => prop.Type.GetTypeString(
190188
#>
191189
return $this;
192190
}
191+
193192
<#
194193
}
195194
}

0 commit comments

Comments
 (0)