Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony Undefined namespace

Tags:

php

symfony

I am seeing namespace errors all over the place and I am not sure why.

For exampe I have: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; and Configuration is in red and the error reads:

Undefined namespace Configuration less... (Ctrl+F1) 
Referenced namespace is not found.

How do I fix this?

like image 222
iamthestreets Avatar asked May 22 '16 01:05

iamthestreets


1 Answers

Since you say "Configuration is in red" I assume the problem you are experiencing is related to the IDE

If you are using PHPStorm there's a specific Symfony plugin that handle all the namespacing pretty much automatically, as long as your setup is standard. By standard I mean a project dir containing the app/ src/ web/ ... dirs (if you're using the 2.x Symfony dir layout)

This link will tell you everything you need, in great detail

like image 107
Marco Albarelli Avatar answered Oct 29 '22 15:10

Marco Albarelli