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

💡 Parent fiields when fetching entities with JTI #404

Closed
msmakouz opened this issue Mar 29, 2023 · 0 comments · Fixed by #405
Closed

💡 Parent fiields when fetching entities with JTI #404

msmakouz opened this issue Mar 29, 2023 · 0 comments · Fixed by #405
Assignees
Labels
type:feature New feature.
Milestone

Comments

@msmakouz
Copy link
Member

msmakouz commented Mar 29, 2023

I have an idea!

For example, we have an Entity:

#[Entity(role: 'element', table: 'elements')]
abstract class Element
{
    #[Column(type: 'uuid', primary: true, typecast: 'uuid')]
    public UuidInterface $uuid;

    #[Column(type: 'string')]
    public string $organization;
}

And child entity (JTI):

#[Entity(role: 'release', table: 'releases')]
#[JoinedTable]
class Release extends Element
{
    // some properties
}

If we try to select an entity filtered by a field in the parent entity, we will get an error:

$this->findAll([
    'organization' => [
        'in' => $organizations
]);
SQLSTATE[42703]: Undefined column: 7 ERROR: column release.organization does not exist LINE 7: WHERE ("release"."organization" IN ($1) AND "release".... ^

I think, it is necessary to automatically determine that the field is in the parent table or add an alias

@msmakouz msmakouz added the type:feature New feature. label Mar 29, 2023
@roxblnfk roxblnfk added this to the 2.3.x milestone Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants