I have the following code:
namespace Acme\StoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Acme\StoreBundle\Entity\User
*
* @ORM\Table(name="users")
* @ORM\Entity()
*/
class User {
...
}
$user = new User();
Does anybody know how I can now get the entity name (AcmeStoreBundle:User
) from the User
object?
This should always work (no return of Proxy class):
As
getClassMetadata
is deprecated, you can now usegetMetadataFor
PHP
get_class()
function will returnUser
and namespace (see comments in php docs).getClassMetadata() is deprecated and will be removed in the future. Use getMetadataFor() instead:
Or a complete function: