msgraph-sdk-php icon indicating copy to clipboard operation
msgraph-sdk-php copied to clipboard

Refactor common model code to base class

Open MIchaelMainer opened this issue 5 years ago • 0 comments

The issue here is that there is special generation code for Entity that is used by all models. This common functionality gets/sets the OData type and serializes an object.

The PHP library doesn't make a distinction between a model based on an entity or complex type. Since Entity was already a common base for all entities, it was used for all complex types.

Proposal:

  • add a BaseModel class in https://github.com/microsoftgraph/msgraph-sdk-php that would be used to contain the common code for both Entity and ComplexType.
  • refactor generator code to use the BaseModel class and remove the common code from the template.

This work will also support us refactoring out a php-core library as well as give us and customers a way to create custom models with the common code.

We bundle this work with other breaking changes since customers could've taken a dependency on the ID property of the base entity. AB#7365

MIchaelMainer avatar Jun 30 '20 00:06 MIchaelMainer