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

Improve support for Enum Flags

Open tomw-ucb opened this issue 2 years ago • 4 comments

Dear MS team,

We have a few win32LobApps (Beta model) in our Intune environment, where we can not access the applicableArchitectures property, due that it does not recognize the enumeration value "x86,x64"

Involved classes : Beta\Microsoft\Graph\Model\Beta\Microsoft\Win32LobApp Beta\Microsoft\Graph\Model\Beta\Microsoft\Graph\Model

In the attachments you can find a returned managed app data : ManagedApp_#microsoft.graph.win32LobApp.json.txt

Kind Regards

Tom Werkhoven

tomw-ucb avatar Oct 15 '21 19:10 tomw-ucb

Hello @tomw-ucb, Thank you for reporting the issue and sorry for the inconveniences. To support you better, could you please provide the version of the SDK you are using. You could also try using uppercase names for the Enum values, for example use X86 instead of x86.

SilasKenneth avatar Oct 21 '21 07:10 SilasKenneth

Hi Kenneth

We use the SDK microsoft/microsoft-graph v1.34.0 Graph endpoint https://graph.microsoft.com/beta/deviceAppManagement/mobileApps

We want to read the value of applicableArchitectures returned by Graph via the method of Beta\Microsoft\Graph\Model\Win32LobApp::getApplicableArchitectures(), but the class Beta\Microsoft\Graph\Model\WindowsArchitecture does not contain the Enum value for "x86,x64" (concatenated with a comma).

I guess the best way forward is to modify Win32LobApp::getApplicableArchitectures() to handle multiple values as already provided by Graph.

Regards, Tom

tomw-ucb avatar Oct 21 '21 11:10 tomw-ucb

@SilasKenneth This is a missing feature. We need to support enums with flag values.

@tomw-ucb In the meantime, you'll need to use getProperties() to access the property dictionary to access those values.

@Ndiritu Regarding the conversation around supporting enums in PHP 8.1, I don't think enum flags are supported. We should consider this case.

MIchaelMainer avatar Oct 25 '21 16:10 MIchaelMainer

(Update) v2 Preview allows setting Enum flags by comma separating values e.g. new WindowsArchitecture(WindowsArchitecture::X86.",".WindowsArchitecture::X86);. Not the ideal solution. Can be improved.

Ndiritu avatar Oct 06 '22 08:10 Ndiritu

Resolved in v2.0 of this SDK

Ndiritu avatar Jan 31 '24 17:01 Ndiritu