Zend Framework 2 + Doctrine2 - No Objects Detected

Hi, I used the composer to create the ZF2 skeleton. Installed module doctrine-module, doctrine-orm-module, etc. Below:

{ "name": "zendframework/skeleton-application", "description": "Skeleton Application for ZF2", "license": "BSD-3-Clause", "keywords": [ "framework", "zf2" ], "homepage": "http://framework.zend.com/", "require": { "php": ">=5.3.3", "zendframework/zendframework": "2.2.*", "doctrine/doctrine-orm-module": "0.*", "doctrine/data-fixtures": "dev-master", "zendframework/zend-developer-tools": "dev-master", "doctrine/migrations": "dev-master", "bjyoungblood/bjy-profiler": "dev-master", "zendframework/zftool": "dev-master" } }

The doctrine configuration is added to the module as follows:

'doctrine' => array( 'driver' => array( __NAMESPACE__.'_entities' => array( 'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver', //'cache' => 'array', 'paths' => array( __DIR__ . '/../src/'. __NAMESPACE__ .'/Entity', ) ), 'orm_default' => array( 'drivers' => array( __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_entities' ) ))),

And I added my essence to: Module / Application / SRC / Application / Object / User.php

But when I run: php zf.php orm: info

I get the following message:

[Exception]
You do not have attached doctrine ORM objects according to your current configuration. If you have entities or mapping files, you should check the display configuration for errors.

If i try

php zf.php orm: schema-tool: create

I get:

There are no metadata classes to process.

Doctrine ? ?

: , :

<?php
namespace Application\Entity;
use Doctrine\ORM\Mapping as ORM;
/** @ORM\Entity */
class User {
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer")
     */
    protected $id;

    /** @ORM\Column(type="string") */
    protected $fullName;
}

,

. , , . tmp, . php zf.php orm: info , . Paralles 8, OSX, - Debian 7. /media/psf/mount.

+3
2

. , , .

. , . , , .

.

+2

__NAMESPACE__ : , , __NAMESPACE__ .

, :

'doctrine' => array(
    'driver' => array(
        'application_driver' => array(
            'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
            'cache' => 'array',
            'paths' => array(
                'module/Application/src/Application/Entity',
            ),
        ),

__DIR__, , ZendApplication chrooted ( public/index.php: chdir(dirname(__DIR__));).

, / :

<?php
namespace Application\Entity;
use Doctrine\ORM\Mapping as ORM;
/** 
 * @ORM\Entity 
 * @ORM\Table(name="user")
 */
class User {
    /**
     * @var int
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    protected $id;

    /** 
     * @var string
     * @ORM\Column(type="string") 
     */
    protected $fullName;

    /** 
     * @return int 
     */
    public function getId()
    {
        return $this->id;
    }

    /** 
     * @param int $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /** 
     * @return string
     */
    public function getFullName()
    {
        return $this->fullName;
    }

    /** 
     * @param string $fullname
     */
    public function setFullName($fullname)
    {
        $this->fullName= $fullname;
    }
}
+2

All Articles