This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Cannot redeclare class with Symfony (2.6) in 2 subfolders

Discuss installing Symfony 2 here

Cannot redeclare class with Symfony (2.6) in 2 subfolders

by bertoost » Thu Mar 19, 2015 4:48 pm

Hi all,

Hopefully I can describe my situation well enough for you to understand. Unfortunate I am not allowed to give real project details away :-(

I have a Symfony 2.6.4 project running and I have deployed it twice on our server. One is the production deployment and one is for staging/testing purposes. Both are deployed in their own subfolders, but next to each other. Like this;

/path/to/symfony/project/production/
/path/to/symfony/project/staging/

When I cd to the production path and run "php app/console doctrine:schema:update --dump-sql" for example, I am getting this error;

Code: Select all
PHP Fatal error:  Cannot redeclare class Namespace\MyBundle\Entity\MyEntity in /path/to/symfony/project/staging/src/Namespace/MyBundle/Entity/MyEntity.php on line x


As you can see, my error is thrown because of the staging path.
To fix this I can run "composer install" again. Then it works on production location but then I am getting the same error on staging location, regarding the production path (vice versa).

Probably something to do with the PSR autoload but does anyone has any idea where I can start to fix this? Assume this should be possible to do.

Many thanks in advance.
bertoost
Junior Member
 
Posts: 1
Joined: Thu Mar 19, 2015 4:38 pm