Reputation: 753
I use vs code but I can't get autocomplete on a doctrine entity when I'm in a controller. For example: $user->getNa... doesn't show getName().
I tried a lot of plugins but no one worked (PHP IntelliSense, PHP Intelephense, PHP Intellisense-Crane, PHP-Autocomplete, Symfony for VSCode, Symfony Snippets).
public function nameAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$EntitiyRepository = $em->getRepository('AppBundle:Entitiy');
$user = $EntitiyRepository->find(5);
$company = $user->getcomp
return $this->render('index.html.twig');
}
Upvotes: 3
Views: 8105
Reputation: 171
you need to install this extension and add this code to your settings.json or .code-workspace file
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
Upvotes: 1
Reputation: 2031
You should probably type hint for VSCode to know which type gets returned by the find method.
public function nameAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$EntitiyRepository = $em->getRepository('AppBundle:Entitiy');
/** @var User $user */
$user = $EntitiyRepository->find(5);
$company = $user->getcomp
return $this->render('index.html.twig');
}
Upvotes: 3