Skip to content

Relation with additional where #844

Description

@tychokamphuis-aqqo

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions