Description
There seems to be inconsistent behaviour between on="change"
and on="update"
. When persisting a new entity with change
the field is left as null
. With 'update` it is filled. Since they are interchangeable i would expect them to function the same.
Let's assume we have the following setup:
class A {
private $name;
/**
* @Gedmo\Blameable(on="update")
*/
private $updatedAt;
[... some other properties]
}
class B {
private $name;
/**
* @Gedmo\Blameable(on="change", fields={"name"})
*/
private $updatedAt;
[... some other properties]
}
I want to use on="update"
for class A
because I do not want to define a list of every property of class A
. On the other hand I need to use on="change"
for class B
to be able to exclude some properties.
This results in a new record of A
setting the updatedAt
but a new record of B
won't.
I discovered #1920 which will make change
also set the value. This would be ok as it is then at least consistent. It would however be preferable to change update
so that it does not set the variable because technically it is not updated but created. Then it would be useful to allow 2 annotations (create
and update
) if you want to also set it on creation.
Can we make them consistent? I would be happy to contribute if you like.