-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define default value on Multiselect Object Type #15871
Define default value on Multiselect Object Type #15871
Conversation
Review Checklist
|
...ls/DataObject/ClassDefinition/DynamicOptionsProvider/MultiSelectOptionsProviderInterface.php
Outdated
Show resolved
Hide resolved
models/DataObject/ClassDefinition/Helper/OptionsProviderResolver.php
Outdated
Show resolved
Hide resolved
...ls/DataObject/ClassDefinition/DynamicOptionsProvider/MultiSelectOptionsProviderInterface.php
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed!
|
Would it be better to provide the option to provide multiple Default values? @kingjia90 @dvesh3 |
@jan888adams sorry for late response. This was not in the scope for v11.1 so we'll start reviewing it for v11.2.
yes, I would add the possibility to set multiple default values for multiselect fields. Could you please take care of it? and resolve the conflicts. thank you! |
04714ec
to
6a30c5e
Compare
...ls/DataObject/ClassDefinition/DynamicOptionsProvider/MultiSelectOptionsProviderInterface.php
Outdated
Show resolved
Hide resolved
models/DataObject/ClassDefinition/Helper/OptionsProviderResolver.php
Outdated
Show resolved
Hide resolved
doc/05_Objects/01_Object_Classes/01_Data_Types/30_Dynamic_Select_Types.md
Outdated
Show resolved
Hide resolved
doc/05_Objects/01_Object_Classes/01_Data_Types/30_Dynamic_Select_Types.md
Outdated
Show resolved
Hide resolved
models/DataObject/ClassDefinition/DynamicOptionsProvider/SelectOptionsProviderInterface.php
Outdated
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed!
|
…er.php Change version 12.0 to 11.1 Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
Co-authored-by: Jacob Dreesen <jacob@hdreesen.de>
b34dcc7
to
6081017
Compare
Kudos, SonarCloud Quality Gate passed!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR, and sorry for the long wait.
Overall LGTM, just found some small issues
doc/05_Objects/01_Object_Classes/01_Data_Types/30_Dynamic_Select_Types.md
Outdated
Show resolved
Hide resolved
models/DataObject/ClassDefinition/Helper/OptionsProviderResolver.php
Outdated
Show resolved
Hide resolved
@jan888adams Do you have some free time to check my feedback on #15871 (review) ? This PR needs to be merged before next week (12th March) for the upcoming |
|
|
The review and finalization of the Merge Request will not be completed until Tuesday, I presume. It would be appreciated if you could finish it. |
@jan888adams this causes throws an error on update from v11.5, looks like a BC break.
Changing the method to Index: models/DataObject/ClassDefinition/Data/Multiselect.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/models/DataObject/ClassDefinition/Data/Multiselect.php b/models/DataObject/ClassDefinition/Data/Multiselect.php
--- a/models/DataObject/ClassDefinition/Data/Multiselect.php
+++ b/models/DataObject/ClassDefinition/Data/Multiselect.php (date 1710260869815)
@@ -75,7 +75,7 @@
/**
* @internal
*/
- public ?array $defaultValue = null;
+ public array|string|null $defaultValue = null;
public function getOptions(): ?array
{
@@ -122,7 +122,7 @@
return $this->renderType;
}
- public function setDefaultValue(array $defaultValue): static
+ public function setDefaultValue(array|string|null $defaultValue): static
{
$this->defaultValue = $defaultValue;
|
…ced by #15871 (#16779) * remove parent interface is bc break * fix bc-break reported by Niklas * Update models/DataObject/ClassDefinition/Data/Multiselect.php Co-authored-by: Sebastian Blank <sebastian.bl@gmx.de> * Update models/DataObject/ClassDefinition/Data/Multiselect.php Co-authored-by: Sebastian Blank <sebastian.bl@gmx.de> * missing default handling for editmode * missing default handling for editmode * enrich definition * enrich definition * enrich definition * Update models/DataObject/ClassDefinition/Data/Multiselect.php Co-authored-by: Sebastian Blank <sebastian.bl@gmx.de> * Fix SelectionProviderTrait (#16782) * Fix SelectionProviderTrait * Change unneeded getOptions() call by string * fix getDataForQueryResource --------- Co-authored-by: Sebastian Blank <sebastian.bl@gmx.de> Co-authored-by: Sebastian Blank <blank@data-factory.net>
🤖 Generated by Copilot at 6a30c5e
Summary
📝🚫♻️
This pull request refactors the multiselect data type and the select types with dynamic options to use a common interface and trait for handling options and default values. It also deprecates the
MultiSelectOptionsProviderInterface
and updates the documentation and theService
class accordingly.Walkthrough
MultiSelectOptionsProviderInterface
with theSelectOptionsProviderInterface
for theMultiselect
class (link, link, link, link, link)DefaultValueTrait
and the default value property to theMultiselect
class (link, link, link)getDataForResource
method of theMultiselect
class to handle the default value logic and convert the array of options to a comma-separated string (link)$optionsProvider
variable in thepreSave
method of theMultiselect
class (link)doGetDefaultValue
method to theMultiselect
class to implement the logic for retrieving the default value from the options provider or the property (link)hasStaticOptions
to theSelectOptionsProviderInterface
to indicate whether the options are context-dependent or not (link)OptionsProviderResolver
class to trigger a deprecation warning when resolving a provider that implements theMultiSelectOptionsProviderInterface
and to allow resolving a provider that implements theSelectOptionsProviderInterface
for both select and multiselect modes (link)