Skip to content

Add table-entity generics support#118

Open
dereuromark wants to merge 1 commit intomasterfrom
feature/table-entity-generics
Open

Add table-entity generics support#118
dereuromark wants to merge 1 commit intomasterfrom
feature/table-entity-generics

Conversation

@dereuromark
Copy link
Copy Markdown
Owner

@dereuromark dereuromark commented Apr 8, 2026

Summary

  • Enable tableEntityQuery and codeCompletionPath config options for IdeHelper
  • Add typed find() method annotations to RolesTable and UsersTable for improved IDE support
  • Update CakePHP to use the copilot/table-entity-generics-clean branch for testing generics

What now works

With these changes, the IDE can now properly infer entity types through the ORM chain:

$entityQuery = $users->find()
    ->where(['active' => true])
    ->matching('Roles')
    ->contain('Roles');
// IDE infers: SelectQuery<User>

$firstUser = $entityQuery->first();
// IDE infers: User|null

$allUsers = $entityQuery->all();
// IDE infers: ResultSetInterface<array-key, User>

$userList = $entityQuery->toArray();
// IDE infers: array<User>

$authQuery = $users->find('auth', ['login' => 'mark']);
// IDE infers: SelectQuery<User>

$hydrationOffQuery = $users->find()->disableHydration();
// IDE infers: SelectQuery<array<string, mixed>>

$firstRow = $hydrationOffQuery->first();
// IDE infers: array<string, mixed>|null

Enable tableEntityQuery and codeCompletionPath config options for
IdeHelper. Add typed find() method annotations to RolesTable and
UsersTable for improved IDE support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant