UnexpectedFieldException example

$existence = EntityExistence::createEmpty();
        $fieldPath = $parameters->getPath() . '/' . $field->getPropertyName();

        $propertyKeys = array_map(fn (Field $field) => $field->getPropertyName()$field->getPropertyMapping());

        // If a mapping is defined, you should not send properties that are undefined.         // Sending undefined fields will throw an UnexpectedFieldException         $keyDiff = array_diff(array_keys($data)$propertyKeys);
        if (\count($keyDiff)) {
            foreach ($keyDiff as $fieldName) {
                $parameters->getContext()->getExceptions()->add(
                    new UnexpectedFieldException($fieldPath . '/' . $fieldName(string) $fieldName)
                );
            }
        }

        foreach ($field->getPropertyMapping() as $nestedField) {
            $kvPair = $stack->pop($nestedField->getPropertyName());

            if ($kvPair === null) {
                // The writer updates the whole field, so there is no possibility to update                 // "some" fields. To enable a merge, we have to respect the $existence state                 // for correct constraint validation. In addition the writer has to be rewritten
Home | Imprint | This part of the site doesn't use cookies.