小编roc*_*com的帖子

doctrine targetEntity接口

我试图将接口用作"targetEntity".简单的代码应该解释我打算做什么

接口:

namespace Project\Entity;

interface AnimalInterface{


}
Run Code Online (Sandbox Code Playgroud)

猫:

namespace Project\Entity;
use Doctrine\ORM\Mapping as ORM;
use Project\Entity\AnimalInterface;

/**
 * Represents an Invoice.
 *
 * @ORM\Entity
 * @ORM\Table(name="Cat")
 */
class Cat implements AnimalInterface  {

     /**
     * @var int
     * @ORM\Id @ORM\Column(type="integer", name="id")
     * @ORM\GeneratedValue
     */
     protected $id;
}
Run Code Online (Sandbox Code Playgroud)

狗:

namespace Project\Entity;
use Doctrine\ORM\Mapping as ORM;
use Project\Entity\AnimalInterface;

/**
 * @ORM\Entity
 * @ORM\Table(name="Dog")
 */
class Dog implements AnimalInterface  {

     /**
     * @var int
     * @ORM\Id @ORM\Column(type="integer", name="id")
     * @ORM\GeneratedValue
     */
     protected $id;
} …
Run Code Online (Sandbox Code Playgroud)

doctrine zend-framework

7
推荐指数
1
解决办法
1567
查看次数

标签 统计

doctrine ×1

zend-framework ×1