Get entity name from class object

后端 未结 4 859
予麋鹿
予麋鹿 2021-01-17 08:23

I have the following code:

namespace Acme\\StoreBundle\\Entity;

use Doctrine\\ORM\\Mapping as ORM;

/**
 * Acme\\StoreBundle\\Entity\\User
 *
 * @ORM\\Tabl         


        
4条回答
  •  没有蜡笔的小新
    2021-01-17 08:58

    You can use php's instanceOf operator:

    if($a instanceof MyClass) { /*code*/ }
    

    https://www.php.net/manual/pt_BR/language.operators.type.php

提交回复
热议问题