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 doctrine:generate:form AibPlatformBundle:User
Now I have change the namespace to Aib\PlatformBundle\Entity\Identity\User, but when I try to generate the form with the task I said before it says:
"Class Aib\PlatformBundle\Entity\User is not a valid entity or mapped super class."
This is the file content:
<?php
namespace Aib\PlatformBundle\Entity\Identity;
use Doctrine\ORM\Mapping as ORM;
/**
* Aib\PlatformBundle\Entity\Identity\User
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Aib\PlatformBundle\Entity\Identity
\UserRepository")
*/
class User
{
...
Any idea?
symfony2.0.4
Had this problem - don't forget the annotation * @ORM\Entity
like below:
/**
* Powma\ServiceBundle\Entity\User
*
* @ORM\Entity
* @ORM\Table(name="users")
*/
Had this problem yesterday and found this thread. I created the entity with the mapping in a new bundle (e.g. MyFooBundle/Entity/User.php), did all the configuration according to the docs but got the same error from above when trying to load the app.
In the end I realized that I wasn't loading MyFooBundle in AppKernel:
new My\FooBundle\MyFooBundle()
A great way to debug this is to run this command:
app/console doctrine:mapping:info
Do check your config.yml file, should be containing something like this:
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
types:
json: Sonata\Doctrine\Types\JsonType
orm:
auto_generate_proxy_classes: %kernel.debug%
# auto_mapping: true
entity_managers:
default:
mappings:
FOSUserBundle: ~
# ApplicationSonataUserBundle: ~
YourUserBundle: ~
SonataUserBundle: ~
Add your own bundle to the mappings list.
I resolved this issue by setting $useSimpleAnnotationReader=false
when creating the MetaDataConfiguration
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With