Find the best Rector rule to solve your problem. Searching through 661 rules.
Found 2 rules:
Change annotation to attribute
use Symfony\Component\Routing\Annotation\Route;
class SymfonyRoute
{
- /**
- * @Route("/path", name="action") api route
- */
+ #[Route(path: '/path', name: 'action')] // api route
public function action()
{
}
}
Replace $this->getDoctrine() and $this->dispatchMessage() calls in AbstractController with direct service use
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+use Doctrine\Persistence\ManagerRegistry;
final class SomeController extends AbstractController
{
+ public function __construct(
+ private ManagerRegistry $managerRegistry
+ ) {
+ }
+
public function run()
{
- $productRepository = $this->getDoctrine()->getRepository(Product::class);
+ $productRepository = $this->managerRegistry->getRepository(Product::class);
}
}