DoctrineBehaviors icon indicating copy to clipboard operation
DoctrineBehaviors copied to clipboard

Custom field name for Blameable trait

Open Armalon opened this issue 2 years ago • 0 comments

Is there a possibility to have a custom field name in the DB table using Blameable trait? In my current DB schema this field named as createdBy_id and I need to migrate to KnpLabs approach without the need to change the field name. Rewriting Blameable trait with my own annotations like the following:

#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'createdBy_id', referencedColumnName: 'id', onDelete: 'SET NULL')]
protected $createdBy;

#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'updatedBy_id', referencedColumnName: 'id', onDelete: 'SET NULL')]
protected $updatedBy;

Didn't help, because cratedBy, updatedBy and deletedBy fields being mapped second time and I get the following error image Any ideas?

Armalon avatar Apr 15 '22 07:04 Armalon