DoctrineBehaviors
DoctrineBehaviors copied to clipboard
Custom field name for Blameable trait
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
Any ideas?