Skip to content

Error When Running php spark schemas with CodeIgniter Shield: Cannot Instantiate Abstract Class #48

@haykaf

Description

@haykaf

Hello,

I've encountered an issue when using the Tatter\Schemas package in combination with the official CodeIgniter Shield package. When attempting to run the php spark schemas command to generate schema files, I receive the following error message:

CodeIgniter v4.4.4 Command Line Tool - Server Time: 2024-02-05 22:02:35 UTC+00:00

[Error]
Cannot instantiate abstract class CodeIgniter\Shield\Models\BaseModel
at VENDORPATH/tatter/schemas/src/Drafter/Handlers/ModelHandler.php:173

Backtrace:
  1    VENDORPATH/tatter/schemas/src/Drafter/Handlers/ModelHandler.php:84
       Tatter\Schemas\Drafter\Handlers\ModelHandler()->getModels()

  2    VENDORPATH/tatter/schemas/src/Schemas.php:165
       Tatter\Schemas\Drafter\Handlers\ModelHandler()->draft()

  3    VENDORPATH/tatter/schemas/src/Commands/Schemas.php:57
       Tatter\Schemas\Schemas()->draft()

  4    SYSTEMPATH/CLI/Commands.php:65
       Tatter\Schemas\Commands\Schemas()->run()

  5    SYSTEMPATH/CLI/Console.php:46
       CodeIgniter\CLI\Commands()->run()

  6    ROOTPATH/spark:102
       CodeIgniter\CLI\Console()->run()

I believe this issue could be related to how the ModelHandler in the Tatter\Schemas package handles model instantiation, particularly with abstract classes like BaseModel in the Shield package.

Any guidance on resolving this error would be greatly appreciated.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions