Comments (4)
Howdy, I found some folks referencing these old isssues and I'd like to update them with more recent opinions. At the time I was dead set on Fractal being a serializer, and thought that serializers should just be serializers.
Deserializers are also incredibly important, and defining contracts multiple times is a pain in the butt. I'd love to see some functionality grow, where one contract can be defined, and both deserialization and serialization can be performed from that contract.
http://trailblazer.to/gems/operation/1.1/representer.html
Trailblazer does this rather well, but the docs can be a little confusing sometimes. There are a lot of gems involved but Roar and Representatable do the most of it I think.
from fractal.
I believe that's beyond the scope of Fractal. Will be up to you to retrieve
and parse data sent from a client.
On 14 Jun 2014 03:02, "Troy Pavlek" [email protected] wrote:
Forgive me if I'm missing something, but it's not immediately apparent to
me nor does it seem to be mentioned in the docs:What about recieving data? If I have an object in the database, and for
simplicity's sake let's us the example that in the database a column is
called "start_date", I transform this to simply be "start" when it's sent
to the client. Now, when I recieve data back, it will obviously just be a
"start" property, which isn't actually in the database.Do transformers support inverting their own operations?
—
Reply to this email directly or view it on GitHub
#65.
from fractal.
Saving data is much easier, and as Jason said it's not a job for Fractal.
You can solve this with DDD, using entity objects to set up the data, or just building an array of input data, then pass that off to your model. Your repository or model can have a create() and a update() method, both of which structure and validate this data.
from fractal.
@philsturgeon That link is now dead, and in any case refers to Ruby code, not PHP code. Do you have any recommendations for getting this behavior in a way that complements a Fractal transformer? Is there any likelihood in it being added here? (I note that this issue and many similar ones remain closed.)
from fractal.
Related Issues (20)
- [JsonApiSerializer] A way to return requested realtionship without attributes and links HOT 2
- Filters on relationships HOT 4
- How to transform when Parent Child Relation in same Table HOT 1
- Sparse Fieldsets without calculations HOT 2
- Modernize like it's 1.0 HOT 3
- What a current state of this project? PHP8 support plans? HOT 3
- Scope class toArray() method takes too much time HOT 4
- Possible incorrect pagination output from JsonApiSerializer HOT 2
- Support 7.4
- How to create custom ArraySerializer with the result of meta pagination array inside the collection array HOT 2
- JSON structure changed between v0.19.2 and v0.20.0 HOT 13
- Please use SEMVER on this package! HOT 7
- Breaking change between 0.19.2 and 0.20.0 HOT 1
- Update version 0.19.2 -> 0.19.3
- How to set `includes` for specific `includeItem` in the code for transformer?
- How to leave `data` resource key only for root transformer? HOT 1
- [Suggestion] Use a container to fetch transformers HOT 1
- How to make output of nested array
- Scope.php::fireTransformer is unable to handle `null` $transformer
- Is this package dead? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fractal.