Reputation: 81
I have created the ORM file for my table remuneration
. I already, created the Form type file for the same ORM file. I have used to generate the entity "ClientRemuneration" using this command:
php bin/console doctrine:generate:entities AppBundle/Entity/ClientRemuneration
But, it not working and throw this error:
Class "DatumGraph\Spade\MasterBundle\Entity\ClientRemuneration" is not a valid entity or mapped super class".
Please help me out from this problem.
Upvotes: 2
Views: 5306
Reputation: 2280
Because you're missing the @ORM\Entity
annotation on your class, Doctrine throws the exception you mention.
Take a look to the official doctrine symfony doc for more informations: https://symfony.com/doc/current/doctrine.html
Define the real entity:
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class ClientRemuneration extends BaseUser
{
// ...
}
Define the super-class as follows:
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\MappedSuperclass
*/
abstract class BaseUser
{
// ...
}
Generate entities (getters and setters):
If you are using symfony app version > 4.0, then you should use bin/console make:entity --regenerate
to generate entities.
Else, you should use bin/console doctrine:generate:entities
command.
Generate Entity(The php class):
If you are using symfony app version > 4.0, then you should use bin/console make:entity
to generate the entity.
Else, you should use bin/console doctrine:generate:èntity
command.
Upvotes: 4