Integrating Doctrine in CodeIgniter 3 - entity err

2019-08-09 07:03发布

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.

1条回答
放我归山
2楼-- · 2019-08-09 07:10

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

查看更多
登录 后发表回答