Skip to content

BUG: Proxy class building destroys nested attributes or enums #3511

@mficzel

Description

@mficzel

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Proxy Building seems to destroy nested Attributes. This is an additional reason why ORM Attributes cannot yet be used. However it is important that fixing this will not enable ORM Attributes yet.

When the following Attributes are added to a class that is proxied:

#[Flow\Entity]
#[ORM\Table(uniqueConstraints: [
    new ORM\UniqueConstraint(name: 'nodeData_name_value', columns: ["nodedata", "name", "value"])
])]

the following code is generated in the proxy class

#[Flow\Entity]
#[\Doctrine\ORM\Mapping\Table(uniqueConstraints: array (
    0 =>
        \Doctrine\ORM\Mapping\UniqueConstraint::__set_state(array(
            'name' => 'nodeData_name_value',
            'columns' =>
                array (
                    0 => 'nodedata',
                    1 => 'name',
                    2 => 'value',
                ),
            'fields' => NULL,
            'options' => NULL,
        )),
))]

Expected Behavior

The generated code should be similar to the original

#[Flow\Entity]
#[ORM\Table(uniqueConstraints: [
   new ORM\UniqueConstraint(name: 'nodeData_name_value', columns: ["nodedata", "name", "value"])
])]

Steps To Reproduce

No response

Environment

- Flow: 8.3+ 8,4+
- PHP: 8.0+

Anything else?

Nested Attributes are supported from PHP 8.1 so one could say that we should only support this starting from Neos 8.4 that has PHP 8.2 as minimal requirement.

The attributes of proxy classes are rendered here:

  • Class Attributes \Neos\Flow\ObjectManagement\Proxy\Compiler::renderAttribute
  • Method Attributes \Neos\Flow\ObjectManagement\Proxy\ProxyMethodGenerator::buildAttributesCode

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions