Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relation with additional where #844

Open
tychokamphuis-aqqo opened this issue Sep 25, 2024 · 0 comments
Open

Relation with additional where #844

tychokamphuis-aqqo opened this issue Sep 25, 2024 · 0 comments

Comments

@tychokamphuis-aqqo
Copy link

tychokamphuis-aqqo commented Sep 25, 2024

Hi,

I found an issue where the relation is not resolved when doing an expand. I have the following case in my Car class

#[LodataFunction(name: 'Engine')]
    public function engine()
    {
        return $this->hasOne(Engine::class)
            ->where('brand', '=', $this->brand);
    }

In this case, there is no Engine returned even though the SQL is correct and does give me a result when queried. I believe that the issue here is that the 'Engine' function is called before the parameters are set on the parent model, thus resulting in an empty result and caching that result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant