Home Documentation Download Pricing Buy Now

Using ORM attribute-overrides produces invalid PHP attributes

0 votes

Using ORM attribute-overrides on an entity and exporting using attributes as Doctrine data format produces invalid PHP.

#[ORM\Table(name: "data")]
#[ORM\AttributeOverrides([new ORM\AttributeOverride(name: "test", column: ORM\Column(name: "testing"))])]
class Data
{
  // ...

Causes error: PHP Fatal error: Constant expression contains invalid operations

Seems it's missing new keyword before ORM\Column.
Expected output would be:

#[ORM\Table(name: "data")]
#[ORM\AttributeOverrides([new ORM\AttributeOverride(name: "test", column: new ORM\Column(name: "testing"))])]
class Data
{
  // ...
asked 18 hours ago in Bug report by cvuorinen (390 points)

thanks. i will let you know with new beta.

1 Answer

0 votes

This is fixed in beta build 3.5.1.1888, which is available now.

The nested ORM\Column inside ORM\AttributeOverrides was exported without the new keyword, so PHP rejected the file. The export now produces:

#[ORM\AttributeOverrides([new ORM\AttributeOverride(name: "test", column: new ORM\Column(name: "testing"))])]

While fixing this we found a second problem in the same area: importing attribute overrides from PHP 8 attributes lost their content, so they came back as an empty list on the next export. That is corrected as well.

You can get the build here: https://www.skipper18.com/support/402/downloads-skipper-beta

Thank you for the report.

answered 13 hours ago by ludek.vodicka Skipper developer (140,970 points)
...