Home > other >  Symfony 6: Command "make:repository" is not defined
Symfony 6: Command "make:repository" is not defined

Time:02-04

I did a fresh installation.

  • OS: Ubuntu Linux 22.04.1
  • Kernel: Linux 5.15.0-58-generic on x86_64
  • PHP 8.1.2
  • Symfony 6.2.6 (env: dev, debug: true)
  • Doctrine: 2.14.1

This is what I did to create an empty project with Symfony:

cd /var/www/html
symfony new <project>
cd <project>
composer req --dev symfony/profiler-pack
composer req maker doctrine twig asset

Server (symfony server:start) is working fine. Profiler also.

But maker does not know about repositories.

php bin/console make:repository

[critical] Error thrown while running command "'make:repository'". Message: "Command "make:repository" is not defined.

What now?

CodePudding user response:

This worked:

php bin/console make:entity --regenerate App

It generates the repository classes.

God knows why.

CodePudding user response:

The repository is created only after the entity is created, namely, you must initially create the entity through the bin/console make:entity command, and only then will you have the repository created

  • Related