/** * @return array[] */ public function getNestedValues() : array { $values = []; foreach ($this->data->getIndexes($this->key) as $index) { $key = $this->key . '[' . $index . ']'; if ($this->data->hasKey($key)) { $values[] = $this->data->getValue($key); } } return $values; }
public function bind(Data $data) : BindResult { $values = []; $formErrorSequence = new FormErrorSequence(); foreach ($data->getIndexes($this->key) as $index) { $bindResult = $this->wrappedMapping->withPrefixAndRelativeKey($this->key, $index)->bind($data); if (!$bindResult->isSuccess()) { $formErrorSequence = $formErrorSequence->merge($bindResult->getFormErrorSequence()); continue; } $values[] = $bindResult->getValue(); } if (!$formErrorSequence->isEmpty()) { return BindResult::fromFormErrorSequence($formErrorSequence); } return $this->applyConstraints($values, $this->key); }