💡 Parent fiields when fetching entities with JTI
msmakouz opened this issue · 0 comments
msmakouz commented
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