Add string field for date columns and ColumnCodeProducer cleanup#122
Open
mringler wants to merge 3 commits intoperplorm:mainfrom
Open
Add string field for date columns and ColumnCodeProducer cleanup#122mringler wants to merge 3 commits intoperplorm:mainfrom
mringler wants to merge 3 commits intoperplorm:mainfrom
Conversation
Collaborator
Author
|
This breaks BC when a new $date = new DateTime(...);
$row->setDate($date);
$date->setTime(...); // <----- will not change actual value in $row, but did before
$row->save();Note that neither version stores such a change when the object from the row is used: $row = RowQuery::create()->findOne();
$row->getDate()->setTime(...);
$row->save(); // field is not marked as changed, so nothing happens |
af93a42 to
b3ae361
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, temporal columns are stored as
DateTimeInterfaceobjects, which are created when the model object is hydrated.This PR stores the value as
string, theDateTimeInterfaceobject is only created on access and stored in a second object property. Using the date string as default means fewer object have to be created (as long as the date field is not accessed), and it provides a value for binding to prepared statements without having to callDateTimeInterface::format().Splitting database fields into a raw value and a deserialized value attribute is used for all columns with serialization (like types
OBJECT,BINARY_SET,ARRAY), and I used the occasion to unify that code into a newAbstractDeserializableColumnCodeProducer, which all those CodeProducers extend now.Changing the way time columns work affected code in ObjectBuilder, which I split up and moved into the corresponding CodeProducers (like
ObjectBuilder::addClear(),ObjectBuilder::addHydrateBody()).Also, the ColumnCodeProducers now use a method that creates the whole variable access string (
'$this->my_field'), which makes template code much more readable:instead of
I disabled a broken sniffer rule from Spryker, it does not recognize that a param
string|null $paramis nullable (only?string $paramis considered nullable). This is an issue inspryker/code-sniffer/Spryker/Sniffs/Commenting/DocBlockParamAllowDefaultValueSniff.php.Psalm currently has a bug where it complains about the
#[\Override]attribute on functions (see bug report), causing CI to fail.