@ORM\Column(name="xyz") not working

I have a plugin that devides some tags into groups, so each group can contain multiple tags but each tag only has one group. In the Tag-Class i defined the group like with a custom name (@ORM\Column(name="groupname")) but the custom name is being ignored.

Tagname and group are part of @Flow\Identity. Here is part of the model:

class Tag

     * @var string
     * @Flow\Validate(type="NotEmpty")
     * @Flow\Validate(type="StringLength", options={ "maximum"=255 })
     * @Flow\Identity
    protected $name;

     * @var Group
     * @ORM\Column(name="groupname", nullable=false)
     * @ORM\ManyToOne(targetEntity="\Vendor\TagManager\Domain\Model\Group")
     * @Flow\Validate(type="NotEmpty")
     * @Flow\Identity
    protected $group;


However, the problem is, that the custom column name still is group and therefor leads to some problems in the mysql-queries as GROUP has reserved meanings. Is there still something missing? Or is there a bug in Neos/Doctrine?

Did you create a migration with the annotation in place?

I tryed to create a migration but it didn’t create one as it didn’t notice the change.

The class schema cache can sometime cause issues, so make sure that you empty all cache ./flow neos.flow:cache:flush --force and then create the migration again :slight_smile:

It still says

No changes detected in your mapping information.

when i run flow doctrine:migrationgenerate.

I now renamed the property group to taggroup and updated all relevant parts of the code including templates, getter and setter and controller.

Very strange. Might need some digging to understand what’s going on.

I can confirm this behaviour!

Since the @ORM\Column(name=“xyz”) annotation seems to be ignored when calculating differences between domain model and database table, a possible workaround is:

  1. Delete the property in the domain model
  2. Generate a new migration
  3. Add the property (with the new name) to the domain model
  4. Again, generate a new migration

May be this belongs to this topic as well:

The addition of backticks to the @ORM\Column(name="myName") (imagine arround myName - they’re not displayed properly due to the “rich text formatting”) annotation does not automatically add backticks to the corresponding, generated SQL statements (as described here: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#quoting-reserved-words).