Comments (6)
Hi,
It looks to me that everything is working fine :
When you call a relation, the real object is not fetched but a proxy object is created containing only the ID and every other property is null
You have a initialization Tracker
property saying that it is not initialized too.
You can found more about this on the ocramius/proxy-manager
package.
If you call ->getNumero()
it should work too
from rest-client-sdk.
It looks to me that everything is working fine
it is working fine, but when you call getNumero from the controller the condition if(!$isAllowedMethod) becomes false.
I investigated this again and i found this that the condition needs parenthesis in the first part like this:
vendor/mapado/rest-client-sdk/src/SdkClient.php:209
$isAllowedMethod = ('jsonSerialize' === $method || '__set' === $method || '__isset' === $method) && 'id' === $parameters['name'];
and whit that parenthesis works.........i don't know why hahaha
maybe something about php logic or something.
from rest-client-sdk.
The isset
needs to be coupled with the $id
so putting the parenthesis does make other call to bug.
I will have a look at this tomorrow because it's not easy to debug on my phone 😁
Can you copy your entity Metadata to reproduce?
Thanks
from rest-client-sdk.
OK So I reviewed briefly the code.
First of all, you referenced line 209 for $isAllowedMethod
, so you might not be on the latest version of the package.
Secondly, the $isAllowedMethod
is possibly not a great name for the variable, but you can see it as $isAllowedMethod = !$willInstanciateProxy
ie. if $isAllowedMethod
is false is the normal case when calling any method that need to initialize object.
The only calls you can do without initializing the object is calling isset($obj->getId())
, call json_encode($obj)
or calling the magic setter.
Can you make dump the return of $agenteRepository->find(20)->getOficina()->getNumero()
?
Theoretically, it should :
- make a call to
/agentes/20
- make a call to
/oficinas/xxx
- return the office number.
from rest-client-sdk.
@rubiodamian is this bug still opened ?
from rest-client-sdk.
Closing due to inactivity. Feel free to re-open and provide more info if it is still relevant.
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
- support of partial entities HOT 8
- 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
- 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.