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

44 refactor model data serialization #47

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

Conversation

hagabaka
Copy link
Contributor

Allow Version subclasses to override method of serializing and deserializing model data

Yaohan Chen added 3 commits November 16, 2018 14:32
When a model uses `$casts = ['field' => 'array']` with a JSON field,
getAttributes() will return the JSON-encoded string, while
$model->fill() expects the input to contain the un-encoded JSON value.
So instead, use attributesToArray() to get the model data,
which will work properly with fill().

Fixes mpociot#43
This allows extending the Version class and changing the migration
to store model data differently

Implements mpociot#44
@codecov-io
Copy link

Codecov Report

Merging #47 into master will increase coverage by 0.03%.
The diff coverage is 90%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #47      +/-   ##
============================================
+ Coverage     99.13%   99.16%   +0.03%     
- Complexity       45       47       +2     
============================================
  Files             3        3              
  Lines           115      120       +5     
============================================
+ Hits            114      119       +5     
  Misses            1        1
Impacted Files Coverage Δ Complexity Δ
src/Mpociot/Versionable/VersionableTrait.php 100% <100%> (ø) 31 <0> (ø) ⬇️
src/Mpociot/Versionable/Version.php 97.43% <88.88%> (+0.37%) 14 <3> (+2) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 536c732...e35bca6. Read the comment docs.

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