命令orm:generate-entities错误:当类在同一名称空间中时找不到类

时间:2015-05-27 11:24:28

标签: php orm doctrine-orm

首先,我很抱歉我的英语很差,我是法国人。

当我使用时:

@foreach($product as $productAccept) <a href="{{route('accept-product', ['id' => $productAccept->id] )}}">Accept</a> @endforeach

我收到此错误:

致命错误:第5行的C:\ xampp \ htdocs \ www \ MyApplication \ model \ Repository \ AnneeCultureRepository.php中找不到类'Repository \ DefaultRepository'

我使用Composer

安装了Doctrine2

文件结构是:

/{!! $productAccept->id !!}

bootstrap.php:

php ./vendor/doctrine/orm/bin/doctrine orm:generate-entities ./model --generate-annotations=true

cli-config.php:

- library
--- intern
----- bootstrap.php
----- cli-config.php
- model
--- Entity
----- AnneeCulture.php
--- Repository
----- AnneeCultureRepository.php
----- DefaultRepository.php
- vendor

AnneeCultureRepository.php:

<?php

use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

require_once "vendor/autoload.php";

$paths = array("model");
$isDevMode = true;

// the connection configuration
$dbParams = array(
    'driver'        => 'pdo_mysql',
    'dbname'        => 'MyApplicationDb',
    'user'          => 'root',
    'password'      => '',
    'host'          => 'localhost',
    'charset'       => 'utf8',
    'driverOptions' => array( 1002=>'SET NAMES utf8')
);

$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, null, null, false);
$entityManager = EntityManager::create($dbParams, $config);

defaultRepository.php

<?php

use Doctrine\ORM\Tools\Console\ConsoleRunner;

require_once 'bootstrap.php';

return ConsoleRunner::createHelperSet($entityManager);

我在收到此错误时出错了什么?

0 个答案:

没有答案