Comments (5)
Hi @tylergets
I've looked into this and it's going to involve some interface changes. As I'm probably going to have to make interface changes when I sort out all the relationships stuff (see #60) I'll include it in that change.
I'm going to do a release of the 1.0 changes I've already made on #60, then will probably move on to the relationship stuff next.
from laravel-json-api.
Hi. The with
is only called on index calls at the moment. I can change this but wasn't sure what the point of calling it on a read call is? Because N+1 would only occur if you are loading multiple Auction objects, which you wouldn't on a read request (because it is for a single record).
Unless I'm missing something?! Happy to discuss as if there's a good reason it's needed for the with
request this can be added.
from laravel-json-api.
@lindyhopchris In my case, I am including the nested relationships "items,items.bids,items.bids.bidder"
I need to eager load the Bidder object which is N+1ed on a read. Unless I am looking at this wrong?
from laravel-json-api.
ah, ok that makes sense - couldn't see that in your adapter's with
method.
it makes sense for the change to be implemented. I'll take a look at what it involves - I suspect I'd need to include it in the next release because it'll be breaking (I'll have to modify the AdapterInterface
so that the find method receives the encoding parameters from the client).
from laravel-json-api.
This change is now included on the develop
(1.0) branch.
The Eloquent adapter now converts JSON API include paths into Eloquent relationship paths for eager loading e.g. comments.created-by
is converted to comments.createdBy
for eager loading. If you need to map these paths differently, you can specify this using the $includePaths
property of your adapter. See https://github.com/cloudcreativity/laravel-json-api/blob/develop/src/Eloquent/Concerns/IncludesModels.php#L18-L47
It also continues to support default paths for eager loading on the $defaultWith
property.
In addition, eager loading is now also supported when reading and updating specific resources.
from laravel-json-api.
Related Issues (20)
- Pagination In Custom Method HOT 1
- Unable to create json api resource with attribute name "type" HOT 3
- Self-relation doesn't include model fields HOT 5
- Arguement 3 passed to controller must be an instance of model, string given
- Support for multiple operations in a single request HOT 2
- use Errors Handling in Laravel 8 HOT 1
- Why does json-api trimming spaces in my attributes when updating? HOT 3
- filter slug and underscore HOT 1
- Multiple primary keys - Mysql Error HOT 1
- Sparse fieldsets not working with included relationships HOT 3
- How to attach a middleware to a specific resource relationship? HOT 3
- How I can filter included resources by their fields HOT 8
- Migrate from cloudcreativity/laravel-json-api to laravel-json-api/laravel HOT 15
- How to stop this library from making asterix queries? HOT 1
- Make a request to one endpoint from another controller HOT 5
- Insert on duplicate key upd when inserting a record? HOT 6
- Handle HasMany relationship with extra field. HOT 2
- [5.x] Missing meta HOT 8
- bug: service provider boot throws "No application encryption key has been specified." HOT 1
- Error in tests HOT 1
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 laravel-json-api.