From: Matthias Schmidt Date: Thu, 2 Aug 2018 15:56:57 +0000 (+0200) Subject: Allow more parameter types for `ValueFormFieldDependency::values()` X-Git-Tag: 5.2.0_Alpha_1~364^2~106^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c5a21e9bef7b31d7bf6b046fbe3270527cf9a6d0;p=GitHub%2FWoltLab%2FWCF.git Allow more parameter types for `ValueFormFieldDependency::values()` See #2509 --- diff --git a/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php b/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php index 9d06283744..9fbffd543c 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/dependency/ValueFormFieldDependency.class.php @@ -1,5 +1,6 @@ objectIDs === null) { + $values->readObjects(); + } + + $dboValues = []; + foreach ($values as $object) { + if (!$object::getDatabaseTableIndexIsIdentity()) { + throw new \InvalidArgumentException("The database objects in the passed list must must have an index that identifies the objects."); + } + + $dboValues[] = $object->getObjectID(); + } + + $values = $dboValues; + } + if (empty($values)) { throw new \InvalidArgumentException("Given values are empty."); }