Skip to content

Call to undefined method XXXX\Support\Config\Repositories\ConfigRepository::array() #3266

@xu-li

Description

@xu-li

Code snippet of problem

DataTables::of($query)->make(true);

System details

  • Operating System: Red Hat Enterprise Linux release 9.7 (Plow)
  • PHP Version: 8.2.29
  • Laravel Version: laravel/framework: v12.41.1
  • Laravel-Datatables Version: v12.6.2

Cause
We use a customized ConfigRepository class which extends PersistentRepository from illuminatech/config, 1.4.3. The PersistentRepository class implements Illuminate\Contracts\Config\Repository, which does not define typed retrieval methods such as array().

As a result, when your library calls $config->array(), see DataTables.php, it fails if the configuration repository implements only the contract and not the concrete Laravel repository class.

Expected Behavior / Suggestion
As a third-party Laravel library, it's safest to assume that "Config" (i.e., Illuminate\Support\Facades\Config) will provide an implementation of Illuminate\Contracts\Config\Repository, but not necessarily Illuminate\Config\Repository. Therefore, please avoid using typed retrieval methods not defined on the contract, such as array(), in your code.

BTW, thanks for creating such a great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions