-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Blameable][Timestampable] Inconsistent behaviour of 'on="change"' and 'on="update"' #2023
Comments
I agree that there is an opportunity for a better solution, since this is a pretty common scenario. TL;DR: I don't think we can make this work without breaking changes and a new major release, which is unlikely given the current efforts to maintain this library. Try giving Unfortunately the only way I see it happening is by making breaking changes, either to the functionality of the class B {
/**
* @var string
*/
private $name;
/**
* @Gedmo\Blameable(onCreate=true)
*
* @var \DateTimeInterface
*/
private $createdAt;
/**
* @Gedmo\Blameable(onCreate=true, onChange={"name"})
*
* @var \DateTimeInterface
*/
private $modifiedAt;
} The problem with breaking changes comes down to people resources and maintenance. The original authors of Doctrine Extensions have all moved on, and the couple of us here trying to keep up with issues and occasional bugs can only do so much with the existing library. A new major release just doesn't seem likely. Giving Otherwise, a couple of us are trying to make some headway on a brand new modern version over at https://github.com/doctrine-extensions/doctrine-extensions, if you're interested in contributing your thoughts or code! |
I agree that breaking changes are needed. That's not a bad thing... things move forward and old things get retired. 👍 I find it a shame that a new repo is needed to achieve it. With semver this should be possible here. Even if it starts to rapidly increase major version numbers; people can always use an older version until they are able to upgrade. In the long run people will be happier. |
It could definitely be done here still, there just isn't anyone willing to put the time in. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@franmomu This might be worth revisiting whenever there's focus on significant updates 👍🏼 |
There seems to be inconsistent behaviour between
on="change"
andon="update"
. When persisting a new entity withchange
the field is left asnull
. 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:
I want to use
on="update"
for classA
because I do not want to define a list of every property of classA
. On the other hand I need to useon="change"
for classB
to be able to exclude some properties.This results in a new record of
A
setting theupdatedAt
but a new record ofB
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 changeupdate
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
andupdate
) if you want to also set it on creation.Can we make them consistent? I would be happy to contribute if you like.
The text was updated successfully, but these errors were encountered: