MSGraph-SDK-Code-Generator
MSGraph-SDK-Code-Generator copied to clipboard
Fix an issue with missing OData types.
Summary
This PR replaces references for missing Odata types with Custom types on the microsoft-graph-php-core repo
Generated code differences
See #712 for detailed diff.
Command line arguments to run these changes
N/A
Links to issues or work items this PR addresses
Fixes #524
Microsoft Reviewers: Open in CodeFlow
Idea to make the Date
type useful in v1 as well & fix the Date serialization issue (https://github.com/microsoftgraph/msgraph-sdk-php/issues/704)..
Would it be worthwhile to make the setters for Date types continue to accept a DateTime but set the property to a Date via createFromDateTime
and getters for Date types continue to return DateTime by creating a DateTime from Date's __toString()
? e.g for RecurrenceRange
public function setEndDate($val)
{
$this->_propDict["endDate"] = \Microsoft\Graph\Core\Models\Date::createFromDateTime($val);
return $this;
}
public function getEndDate()
{
if (array_key_exists("endDate", $this->_propDict)) {
if (is_a($this->_propDict["endDate"], "\Microsoft\Graph\Core\Models\Date") || is_null($this->_propDict["endDate"])) {
return new \DateTime((string)$this->_propDict["endDate"]);
} else {
setEndDate($this->_propDict["endDate"]);
return $this->_propDict["endDate"];
}
}
return null;
}
Idea to make the
Date
type useful in v1 as well & fix the Date serialization issue (https://github.com/microsoftgraph/msgraph-sdk-php/issues/704)..Would it be worthwhile to make the setters for Date types continue to accept a DateTime but set the property to a Date via
createFromDateTime
and getters for Date types continue to return DateTime by creating a DateTime from Date's__toString()
? e.g for RecurrenceRangepublic function setEndDate($val) { $this->_propDict["endDate"] = \Microsoft\Graph\Core\Models\Date::createFromDateTime($val); return $this; } public function getEndDate() { if (array_key_exists("endDate", $this->_propDict)) { if (is_a($this->_propDict["endDate"], "\Microsoft\Graph\Core\Models\Date") || is_null($this->_propDict["endDate"])) { return new \DateTime((string)$this->_propDict["endDate"]); } else { setEndDate($this->_propDict["endDate"]); return $this->_propDict["endDate"]; } } return null; }
Unfortunately this might have undefined behaviour where it sometimes returns DateTime type for the getter sometimes Date depending on the type of the property on the propDict.
Idea to make the
Date
type useful in v1 as well & fix the Date serialization issue (microsoftgraph/msgraph-sdk-php#704).. Would it be worthwhile to make the setters for Date types continue to accept a DateTime but set the property to a Date viacreateFromDateTime
and getters for Date types continue to return DateTime by creating a DateTime from Date's__toString()
? e.g for RecurrenceRangepublic function setEndDate($val) { $this->_propDict["endDate"] = \Microsoft\Graph\Core\Models\Date::createFromDateTime($val); return $this; } public function getEndDate() { if (array_key_exists("endDate", $this->_propDict)) { if (is_a($this->_propDict["endDate"], "\Microsoft\Graph\Core\Models\Date") || is_null($this->_propDict["endDate"])) { return new \DateTime((string)$this->_propDict["endDate"]); } else { setEndDate($this->_propDict["endDate"]); return $this->_propDict["endDate"]; } } return null; }
Unfortunately this might have undefined behaviour where it sometimes returns DateTime type for the getter sometimes Date depending on the type of the property on the propDict.
Okay. I'll need to think more. We can leave Date out of v1 for this PR