Skip to content
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

fix timestampable use of datetimeclass #2017

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

smhg
Copy link

@smhg smhg commented Sep 26, 2024

The timestampable behavior doesn't use the generator.dateTime.dateTimeClass setting.
I took a few liberties adressing this:

  • Reusing the getDateTimeClass method of Propel\Generator\Builder\Om\ObjectBuilder. For this it had to become public.
  • PropelDateTime::createHighPrecision expects the output of microtime to be formatted with a dot. This places the formatting in a separate (static) method.
    This allows keeping the updated_at and created_at microtimes in preInsert exactly the same value (instead of generating them independently).

I've avoided simplifying code to not break things.

What do you think?

@smhg
Copy link
Author

smhg commented Sep 27, 2024

@dereuromark based on other PR's it seems the CI errors where not introduced here. I think it is better to address at them in a separate PR, no?

What do you think about this change?

@smhg
Copy link
Author

smhg commented Oct 4, 2024

I get little notifications of GitHub myself, so tagging @PhilinTv and @vol4onok.

@smhg
Copy link
Author

smhg commented Dec 10, 2024

@gechetspr it seems you are my best bet to ping :) Thank you!

This PR would enable the timestampable behaviour to use DateTimeImmutable too (instead of only DateTime).

The CI failures are the same as on all other recent PRs (see comment on #2015). I'm not sure what's happening with mysql, but I will try to have a look at the code-style error.

@smhg smhg force-pushed the fix-timestampable-datetimeclass branch from 939581e to ed0a54d Compare December 10, 2024 13:52
Copy link
Contributor

@gechetspr gechetspr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have tests for src/Propel/Generator/Behavior/Timestampable/TimestampableBehavior.php ? mb we should update those too to make sure that all works as expected?

@smhg
Copy link
Author

smhg commented Dec 10, 2024

I've resolved your remarks. Good suggestions!
Also phpstan and codesniffer weren't happy yet. I've fixed that.

@smhg
Copy link
Author

smhg commented Dec 10, 2024

@gechetspr it looks ok now I think.

@smhg smhg requested a review from gechetspr December 11, 2024 12:19
@smhg smhg requested a review from gechetspr December 12, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants