Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] - Cannot instantiate interface #656

Open
sindyko opened this issue Feb 6, 2025 · 0 comments
Open

[QUESTION] - Cannot instantiate interface #656

sindyko opened this issue Feb 6, 2025 · 0 comments

Comments

@sindyko
Copy link

sindyko commented Feb 6, 2025

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) ?

@sindyko sindyko changed the title Cannot instantiate interface [QUESTION] - Cannot instantiate interface Feb 7, 2025
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

No branches or pull requests

1 participant