|
12 | 12 | namespace Symfony\Bundle\MakerBundle\Maker; |
13 | 13 |
|
14 | 14 | use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
15 | | -use Doctrine\Common\Annotations\Annotation; |
16 | 15 | use Doctrine\ORM\EntityManagerInterface; |
17 | 16 | use Doctrine\ORM\Mapping\Column; |
18 | 17 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
@@ -143,11 +142,11 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma |
143 | 142 |
|
144 | 143 | // see if it makes sense to add the UniqueEntity constraint |
145 | 144 | $userClassDetails = new ClassDetails($this->userClass); |
146 | | - $addAnnotation = false; |
147 | | - if (!$userClassDetails->doesDocBlockContainAnnotation('@UniqueEntity')) { |
148 | | - $addAnnotation = $io->confirm(sprintf('Do you want to add a <comment>@UniqueEntity</comment> validation annotation on your <comment>%s</comment> class to make sure duplicate accounts aren\'t created?', Str::getShortClassName($this->userClass))); |
| 145 | + $this->addUniqueEntityConstraint = false; |
| 146 | + |
| 147 | + if (!$userClassDetails->hasAttribute(UniqueEntity::class)) { |
| 148 | + $this->addUniqueEntityConstraint = $io->confirm(sprintf('Do you want to add a <comment>#[UniqueEntity]</comment> validation attribute to your <comment>%s</comment> class to make sure duplicate accounts aren\'t created?', Str::getShortClassName($this->userClass))); |
149 | 149 | } |
150 | | - $this->addUniqueEntityConstraint = $addAnnotation; |
151 | 150 |
|
152 | 151 | $this->willVerifyEmail = $io->confirm('Do you want to send an email to verify the user\'s email address after registration?', true); |
153 | 152 |
|
@@ -488,11 +487,6 @@ private function getMissingComponentsComposerMessage(): ?string |
488 | 487 |
|
489 | 488 | public function configureDependencies(DependencyBuilder $dependencies): void |
490 | 489 | { |
491 | | - $dependencies->addClassDependency( |
492 | | - Annotation::class, |
493 | | - 'doctrine/annotations' |
494 | | - ); |
495 | | - |
496 | 490 | $dependencies->addClassDependency( |
497 | 491 | AbstractType::class, |
498 | 492 | 'form' |
|
0 commit comments