Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

generating #[ORM\Entity('App\Repository\AlbumRootsRepository::class')] instead of #[ORM\Entity(AlbumRootsRepository::class)] #170

Unanswered
tacman asked this question in Q&A
Discussion options

I'm doing something wrong here, but I can't figure out what. I'm generating

use App\Repository\AlbumRootsRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity('App\Repository\AlbumRootsRepository::class')]
#[ORM\Table(name: 'AlbumRoots')]
final class AlbumRoots

instead of

#[ORM\Entity(AlbumRootsRepository::class)]
#[ORM\Table(name: 'AlbumRoots')]
final class AlbumRoots

The Repository use statement is generated correctly, as seen above, but the entity is comint out as a string.

I'm almost certain this is something simple and basic, but I'm missing it.

$tableName = 'AlbumRoots';
 $namespace = new PhpNamespace('App\Entity');
 $namespace->addUse('Doctrine\ORM\Mapping', 'ORM');
 $namespace->addUse($repoNs = "App\\Repository\\{$tableName}Repository");
 $class = new ClassType($tableName);
 $class->addAttribute('Doctrine\ORM\Mapping\Entity', [$repoNs . '::class']);
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /