在CodeIgniter 3中集成原则3 - 实体错误 [英] Integrating Doctrine in CodeIgniter 3 - entity error

查看:165
本文介绍了在CodeIgniter 3中集成原则3 - 实体错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新教在新教。我试图在我的CodeIgniter实例中集成Doctrine,但是我收到一个错误:


类用户不是有效的实体或映射的超类


实体用户自动完成,如下所示:

 使用Doctrine\ORM\Mapping作为ORM; 

/ **
*用户
*
* @ ORM\Table(name =user)
* @ ORM\Entity
* /
class User
{
/ **
* @var string
*
* @ ORM\Column(name = uid,type =string,length = 255,nullable = false)
* @ ORM\Id
* @ ORM\GeneratedValue(strategy =IDENTITY)
*
private $ uid;

/ **
* @var \DateTime
*
* @ ORM\Column(name =cr_date,type =datetime,可空= false)
* /
private $ crDate ='CURRENT_TIMESTAMP';

/ **
* @var string
*
* @ ORM\Column(name =name,type =string,length = 255 ,nullable = false)
* /
private $ name;

/ **
* @var string
*
* @ ORM\Column(name =password,type =string,length = 255 ,nullable = false)
* /

eaccelerator在我的php.ini文件中被禁用,



Doctrine知道其配置中的正确路径。



回溯如下所示: p>


Backtrace:



文件:
/ var / www / dadgehog / ci / application / third_party / Doctrine / ORM / Mapping / Driver / AnnotationDriver.php
行:89函数:classIsNotAValidEntityOrMappedSuperClass



文件:
/ var /www/dadgehog/ci/application/third_party/Doctrine/ORM/Mapping/ClassMetadataFactory.php
行:117功能:loadMetadataForClass



文件:
/var/www/dadgehog/ci/application/third_party/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php
行:332功能:doLoadMetadata



费尔e:
/var/www/dadgehog/ci/application/third_party/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php
行:216功能:loadMetadata



文件:
/var/www/dadgehog/ci/application/third_party/Doctrine/ORM/EntityManager.php
行:360功能:getMetadataFor



文件:/var/www/dadgehog/ci/application/models/Usermodel.php行:36
功能:查找



文件:/var/www/dadgehog/ci/application/controllers/Login.php行:23
功能:getUser



文件:/ var / www / dadgehog /index.php行:292功能:require_once


如果有人有一个想法指出,我会很开心。 p>

解决方案

官方指南尚未完成,而其他用于CI2。



我将本教程用于SO3为CI3:



如何在CodeIgniter 3中安装Doctrine 3


im new in Doctrine. Im trying to integrate Doctrine in my CodeIgniter instance but i get an error:

Class "User" is not a valid entity or mapped super class.

The entity User was ceated automatically and looks like this:

use Doctrine\ORM\Mapping as ORM;

/**
 * User
 *
 * @ORM\Table(name="user")
 * @ORM\Entity
 */
class User
{
    /**
     * @var string
     *
     * @ORM\Column(name="uid", type="string", length=255, nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $uid;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="cr_date", type="datetime", nullable=false)
     */
    private $crDate = 'CURRENT_TIMESTAMP';

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
     */
    private $name;

    /**
     * @var string
     *
     * @ORM\Column(name="password", type="string", length=255, nullable=false)
     */

eaccelerator is disabled in my php.ini file and was loaded.

Doctrine knows the correct path in its config.

The backtrace looks like this:

Backtrace:

File: /var/www/dadgehog/ci/application/third_party/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php Line: 89 Function: classIsNotAValidEntityOrMappedSuperClass

File: /var/www/dadgehog/ci/application/third_party/Doctrine/ORM/Mapping/ClassMetadataFactory.php Line: 117 Function: loadMetadataForClass

File: /var/www/dadgehog/ci/application/third_party/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php Line: 332 Function: doLoadMetadata

File: /var/www/dadgehog/ci/application/third_party/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php Line: 216 Function: loadMetadata

File: /var/www/dadgehog/ci/application/third_party/Doctrine/ORM/EntityManager.php Line: 360 Function: getMetadataFor

File: /var/www/dadgehog/ci/application/models/Usermodel.php Line: 36 Function: find

File: /var/www/dadgehog/ci/application/controllers/Login.php Line: 23 Function: getUser

File: /var/www/dadgehog/index.php Line: 292 Function: require_once

If anyone has an idea to point that out, i would be happy.

解决方案

The official guide is not complete, and others are for CI2.

I made this tutorial on SO for CI3:

How to install Doctrine in CodeIgniter 3

这篇关于在CodeIgniter 3中集成原则3 - 实体错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆