Eager-loaded polymorphic relationship error #495
                  
                    
                      A-Lawrence
                    
                  
                
                  started this conversation in
                General
              
            Replies: 2 comments
-
| Hi @A-Lawrence, thanks for submitting this issue! I will try to get to it as soon as possible, which might be some time, as we re in the middle of moving. I welcome PRs with failing tests, as well as fixes, if you are able. :) Thanks! | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| hey @mikebronner, thank you for your great package! but this issue still exists and represents blocker for fully usage, is there a plan to get this fixed? thanks in advance. | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
When eager-loading polymorphic relationships, the polymorphic relation appears to be ignored when retrieving from the cache.
The exception below, is raised:
Eloquent Query
Scenario here is that we have SaleItems, with an associated Inventory. Each Inventory can have a polymorphic source (such as an Event).
This query then produces are an error:
It's as though the
sourcepart of the eager loaded relationship, forsettingsorstream, is not loaded (settings exists, stream does not so I'd expect a null return). The only reason thatsaleItem.inventory.source.companyworks is because Inventory has a company() relationship too, to scope to the current tenant.The setup for the involved models, is as below - all of them extend an abstract Model which uses the Cachable trait.
Stack Trace
https://flareapp.io/share/x7XgnRRP#F78
Environment
Edit: Potentially related to #379 - I hadn't spotted this one before posting!
Beta Was this translation helpful? Give feedback.
All reactions