I am working with Laminas DoctrineObjectInputFilter
and want to get value of other property in Callback input filter like this code is in init function of Filter
class which extends DoctrineObjectInputFilter
// input filter whose value is required
$this->add([
'name' => 'name',
'allow_empty' => false,
'filters' => []
]);
// Input filter in which I want value of input name
$this->add([
'name' => 'value',
'allow_empty' => true,
'filters' => [
[
'name' => 'Callback',
'options' => [
'callback' => function ($value) {
$name = // want to get property name value here
if (key_exists($name, $this->applicationConfig) && gettype($value) === 'string') {
return trim(strip_tags($value));
}
else {
return trim($value);
}
return $value;
},
],
],
],
]);
have checked $this->getRawValues()
but its returning null for all inputs.
a bit late but I guess you 're searching for
$context
. Since the value of name is in the sameInputFilter
instance, you can simply use$context
in your callback function.