I had an entity class in Aib\\PlatformBundle\\Entity\\User.php
I had no problems trying to create its form class through
php app/ console doc
I resolved the same exception by deleting a conflicting autogenerated orm.php file in the bundle's Resources/config/doctrine folder; according to the documentation: "A bundle can accept only one metadata definition format. For example, it's not possible to mix YAML metadata definitions with annotated PHP entity class definitions."
In my case the problem was solved by changing my servers cache from eAccelerator to APC. Apparently eAccelerator strips all the comments from files which breaks your annotations.
I resolved this issue by setting $useSimpleAnnotationReader=false
when creating the MetaDataConfiguration
.
Very high possibility that you have PHP 5.3.16 (Symfony 2.x will not work with it). Anyway you should load check page on http://you.site.name/config.php If you had project not worked on hosting server, next lines must be removed in "config.php":
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('This script is only accessible from localhost.');
}
Goodluck!
I solved this by passing false
as the second parameter to Doctrine\ORM\Configuration::newDefaultAnnotationDriver
.
It took me a while of digging through Google and source code.
My case was sort of special since I was using a mapping pointing to another directory unrelated to the Symfony installation as I also had to use legacy code.
I had refactored legacy entities and they stopped working. They used to use @Annotation
instead of @ORM\Annotation
, so after refactoring it simply failed to read the metadata. By not using a simple annotation reader, everything seems to be okayish.
Had this problem - don't forget the annotation * @ORM\Entity
like below:
/**
* Powma\ServiceBundle\Entity\User
*
* @ORM\Entity
* @ORM\Table(name="users")
*/