You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a resource named Portfolio that includes another resource called Company. So there's a relationship between Portfolio and Company. When the Company is included in the Portfolio resource I need to show some data which is not displayed in another context. In order to check the context in the CompanyTransformer, I need the parentScopes to be properly set. But the Scope for the Portfolio resource is created with a null identifier.
Expected Behavior
The Scope for the Portfolio resource (which is the parentScope for Company) should have an identifier instead of null.
When the wrapper method createData located in Fractal.php line 380 calls createData from the manager, the scopeIdentifier parameter is not passed, so the Scope returned has a null identifier.
Proposed Solution
To pass the scopeIdentifier string (Could be the resourceName) as the second parameter when createData is called in the line 408.
Actual Behavior
I have a resource named Portfolio that includes another resource called Company. So there's a relationship between Portfolio and Company. When the Company is included in the Portfolio resource I need to show some data which is not displayed in another context. In order to check the context in the CompanyTransformer, I need the parentScopes to be properly set. But the Scope for the Portfolio resource is created with a null identifier.
Expected Behavior
The Scope for the Portfolio resource (which is the parentScope for Company) should have an identifier instead of null.
Specifications
spatie/fractalistic 2.7.1
spatie/laravel-fractal 5.3.2
Additional Details
When the wrapper method createData located in Fractal.php line 380 calls createData from the manager, the scopeIdentifier parameter is not passed, so the Scope returned has a null identifier.
Proposed Solution
To pass the scopeIdentifier string (Could be the resourceName) as the second parameter when createData is called in the line 408.
return $this->manager->createData($this->getResource(), $this->resourceName);
A unit test could be
The text was updated successfully, but these errors were encountered: