Algo-Web / POData-Laravel

Composer Package to provide Odata functionality to Laravel
MIT License
34 stars 29 forks source link

Cannot expand relation #237

Open CyberiaResurrection opened 4 years ago

CyberiaResurrection commented 4 years ago

@CyberiaResurrection, i try on a new clean instance of laravel and now it has passed this issue, but i have another 2 new issues.

  1. Route login not found. I have in .env APP_DISABLE_AUTH=true and i run artisan config:clear and artisan config:cache and the problem still persist. As a temporary solution, we defined the following 3 routes :

$controllerMethod = '\AlgoWeb\PODataLaravel\Controllers\ODataController@index'; Route::get('odata2.svc/$metadata', ['uses' => $controllerMethod]); Route::any('odata2.svc/{section}', ['uses' => $controllerMethod])->where(['section' => '.*']); Route::any('odata2.svc', ['uses' => $controllerMethod]); Now it's working

  1. When I try to use the $expand parameter based on a relationship defined in the model, I receive the following error:

Symfony\Component\Debug\Exception\FatalThrowableError Argument 2 passed to POData\Providers\Metadata\ResourceAssociationSet::keyNameFromTypeAndProperty() must be an instance of POData\Providers\Metadata\ResourceProperty, null given, called in /var/www/testing/vendor/algo-web/podata/src/POData/UriProcessor/QueryProcessor/ExpandProjectionParser/ExpandProjectionParser.php on line 193

Thank you very much and I really appreciate the effort.

Originally posted by @CalamarMihai in https://github.com/Algo-Web/POData-Laravel/issues/236#issuecomment-598866103

CyberiaResurrection commented 4 years ago

Since I cut a release overnight, and that seems to be a POData issue,@CalamarMihai, can you try setting your POData dependency to 0.3.7 on your testbed to see if that solves your second issue?

c-harris commented 4 years ago

@CyberiaResurrection Can I propose an audit and we suspend anything AUTH related because a number of people have issues with it and the flag does not appear to work properly.

CyberiaResurrection commented 4 years ago

@CalamarMihai, after seeing if explicitly including POData 0.3.7 on your testbed solves your issue or not (since I expect you're using dev-master on POData indirectly), you'll need to give me more information so I can reproduce your second issue, solve it (and, ultimately, add it as a regression test).

CyberiaResurrection commented 4 years ago

@CalamarMihai, all packaged tests are currently passing on a clean install of POData-Laravel itself as at current master HEAD ( https://github.com/Algo-Web/POData-Laravel/commit/7727b6e286c812ce0e58b494801a117950b7cb4e ). This is just trying to constrain where the problem lurks.

@c-harris , given the timing of the report, it looks like something fired up the hyperdrive and departed to east hyperspace among PRs 226 and/or 229 on POData. Given how big and gnarly 229 ended up, I'm suspecting that in lieu of further feedback.

In light of that, what do you propose to audit and what do you propose to look for?

CalamarMihai commented 4 years ago

First, I apologize for the delay. Right now I have done a new test using the versions:

The first issue is ok now, after reinstall, i had no issue with the authentication error.

I tried the common types of relationships supported by Eloquent (belongsTo, hasOne, hasMany, etc..)

Regardless of the value of parameter $expand, even if the relationship exists or not, I receive the same error. If you think it helps, I can make a copy of the project and database and put it on file sharing.

Sorry for my bad english and thanks for your help.

Models.zip

CyberiaResurrection commented 4 years ago

Thanks for your patience, your help and the extra information, @CalamarMihai . I've updated the issue title and will try to investigate in the next few days, as I'm a little busy at the moment (unless @c-harris wants to take a swing).

c-harris commented 4 years ago

I'll take a look shortly and see if we can spin up a regression test for this specific case.

CalamarMihai commented 4 years ago

Any news about this issue?