Comments (8)
Totally ! I think it's an easy pick for a PR if you'd like
from rest-client-sdk.
Hi,
I investigated what was causing the fatal error, and it is more related to proxy generation and caching mixed together than setters:
If I first fetch a partial entity, the entity will be created, using only retrieved values, and will then be stored in cache for later retrieval (using its unique identifier).
If after this, I try to fetch this entity in a "complete" way, its values will be retrieved from cache, and this is when the setters will be called with NULL values because of the way the proxified entities (relations) are handled.
At this point, I thought of another way to make it work: I introduced a special query parameter "_noCache" to explicitely tell the Entity Repository not to cache the retrieved entity. It works, and now performance is great, but this is not what I first had in mind.
This is what the EntityRepository::saveToCache() method looks like now:
protected function saveToCache($key, $value, array $queryParams = [])
{
if (!empty($queryParams['_noCache'])) {
return;
}
// original code here
}
Call to this method from methods find() and __call() now provide the $queryParams variable.
What's your opinion on this ?
from rest-client-sdk.
Well it may work but as I read it it seems like really custom logic you have to pass in your method from your app and that's not really what we want (the purpose is to be really abstract and powerful).
I'll have to see what we made at mapado because we use partial entities intensively so I think we have made this work, but it may be is custom logic.
An idea would be to change the cache key depending on the request Uri but it may be hard to implement.
@zwit maybe you have remember what we have made?
from rest-client-sdk.
I'm not satisfied either by the implementation I pasted above. Any idea is welcome.
from rest-client-sdk.
I investigate about this, but I don't really know how it append.
All call to fetchFromCache
keys contains the query including the parameters
So if you make two call like /foo/1?_groups[]=bar
and /foo/1
, you should have two differents HTTP call and two different cache keys and values.
The proxy is then only made when deserializing the JSON in Serializer if you have a relation.
If you use the Symfony bundle, you may have more informations in the debug toolbar.
Can you provide more information like your entities, the sdk configuration part and the call you make (and ideally the output of the rest-client-sdk part in the debug toolbar) to investigate ?
from rest-client-sdk.
@jmfeurprier is the issue still opened ?
from rest-client-sdk.
Hi,
I switched to other projects which don't use the REST SDK client, so we're not in need any more for fixes (we ended overriding some parts of the tool to suit our customer very specific needs).
Feel free to close the issue.
from rest-client-sdk.
OK thanks.
feel free to re-open the issue if needed
from rest-client-sdk.
Related Issues (20)
- Persisting an entity with a ManyToOne relation does not convert related entity as IRI HOT 10
- Allow an ID instead of an IRI HOT 1
- Handle exceptions from API HOT 3
- paginated hydra collections support HOT 8
- retrieving a list of "abstracted" entities HOT 5
- More recent version of ocramius/proxy-manager HOT 5
- improve performance of related entities retrieval HOT 1
- Do not `PUT` if Unit of work returns an empty diff
- Creating relation entities even when they aren't resources HOT 6
- page collection
- list available types
- Error if the setter does not exists
- Do not allow two `@Rest\Id` fields
- Proxy initializer function bug HOT 6
- Issue with `UnitOfWork` and query parameters
- Use property accessor
- Allow int as id in model
- DateTime : allow customer format
- DateTime : changing timezone
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 rest-client-sdk.