EntityTable: Reference interface, not implementation?

Controllers automatically create the table instance according to their name.

Therefore, if you rename your table class you can either

  1. rename your controller class to InvoicesExcelController as well to automatically get a $this→InvoicesExcel object populated, or

  2. add the following to your controller to manually populate the property:

    public InvoicesExcelTable $InvoicesExcel;
    public function initialize(): void {     
        parent::initialize();     
        $this->InvoicesExcel = $this->fetchTable('InvoicesExcel'); 
    }

All Controllers have the LocatorAwareTrait present in their base class, so you can fetch any table object via Controllers - 5.x

You can’t get table objects injected via the dependency injection container, because we use our own Locator pattern to get instances (this has historic reasons, as the DI container was added in CakePHP 4.2, way past the time, when table objects were already a thing)