在composer.json文件中添加doctrine2的依赖,添加完之后的依赖如下
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2" ],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.5",
"zendframework/zendframework": "~2.5",
"doctrine/doctrine-orm-module": "0.*"//doctrine2依赖
}
}
之后使用composer更新依赖即可
安装后报错及解决
No identifier/primary key specified for Entity (…) Every Entity must have and identifier/primary key没有主键 每一个entity实体类必须有注解
“Class XXX is not a valid entity or mapped super class” after moving the class in the filesystem类不是一个合法的映射每一个类必须都加上@ORM\Entity
注解