Skip to content

[QUESTION] - Cannot instantiate interface #656

Closed
@sindyko

Description

@sindyko

Hi, everyone. Please help me to solve a problem. If I use \LaravelDoctrine\ORM\ORM\Middleware\SubstituteBindings::class in App\Http\Kernel. And call it in Controller:

public function __invoke(CurriculumBlockParams $curriculumBlockParams)
    {
        return view('curriculum-blocks::admin.curriculum-block-params.edit', [
            'curriculumBlockParam' => $curriculumBlockParams,
            'curriculumBlockTypes' => $this->curriculumBlockTypeRepository->findAll()
        ]);
    }

I'm getting an error:
Cannot instantiate interface Modules\CurriculumBlocks\Repositories\CurriculumBlockParams\CurriculumBlockParamsRepository

I try to follow the documentation and have essentially specified the interface reference as stated in the documentation. Or maybe I don't understand something

Entity:

#[ORM\Entity(repositoryClass: CurriculumBlockParamsRepository::class)]
#[ORM\Table(name: "curriculum_block_params")]
class CurriculumBlockParams
{
// code
} 

CurriculumBlockParamsRepository:

interface CurriculumBlockParamsRepository
{
// code
} 

Still what should be specified in repositoryClass in an entity ?
Interface implementation - (class DoctrineCurriculumBlockParamsRepository),
or interface - (interface CurriculumBlockParamsRepository) ?

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