Skip to content

BlockResolver: Invalid typing leads to exception #249

Description

@SimonCremer

Affected Version

2025.4 - LTS

Affected capability

Other

Steps to reproduce

  • Create or edit a data object class
  • Add a block field
  • Add a layout component to the block (add data components as you like aswell)
  • -> The BlockResolver class will run into the exception below because it expects and can handle data components only (function (Data $field) use ($dotNotationParts) Line 66) The Data type here is the problem because layout components have another base class
  • The error becomes visible if you add a select option (in my case with dynamic options provider) and want to select a value in studio ui. Find the exception, from studio backend, below

Actual Behavior

Uncaught PHP Exception TypeError: "Pimcore\Bundle\StudioBackendBundle\FieldDefinition\Parser\Resolver\BlockResolver::Pimcore\Bundle\StudioBackendBundle\FieldDefinition\Parser\Resolver\{closure}(): Argument #1 ($field) must be of type Pimcore\Model\DataObject\ClassDefinition\Data, Pimcore\Model\DataObject\ClassDefinition\Layout\Fieldcontainer given" at BlockResolver.php line 66

Expected Behavior

The Block Resolver should be able to handle all kinds of component types which the class editor allows. There might be more than one solution, therefore creating a PR is not that trivial. You could remove the Data typing, you could add Layout as typing but I don't know if thats all, or if there are other potential types. You could restrict the class editor to allow data components only, but this won't help for existing class definittions and would be a breaking change, therefore it is probably the worst option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Platform Version

    2025.4 - LTS

    Affected capability

    Other

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions