2010-08-23 4 views
1

전에 Doctrine을 (1 또는 2) 건드리지 않은 채로, 나는 this tutorial for Doctrine 2을 따르고 있습니다.Doctrine 2 - "Getting Started XML-Edition"의 문제 - 데이터베이스 스키마 생성

데이터베이스 스키마를 생성하기 위해 명령 줄을 사용하는 시점에 있습니다. 그래도 난 그것을 실행하면, 난 그냥 오류 얻을

<?php 
$cliConfig = new Doctrine\Common\Cli\Configuration(); 
$cliConfig->setAttribute('em', $entityManager); 

:이 튜토리얼에 따라, CLI를-config.php 파일입니다

Fatal error: require(): Failed opening required 'Doctrine\Common\Cli\Configuration.php' 

을 때문에 CLI-설정에 의해 참조 클래스 .php 파일이 존재하지 않습니다. 나는 또한 cli-config.php 파일을 공백으로 채워 봤는데 물론 작동하지도 않는다. "도우미"가 "정의되지 않았습니다."라고 말합니다.

버전 2.0.0BETA3을 사용하고 있습니다. 이 파일은 베타 버전이므로 일부 파일을 바꿀 수는 있지만 그 클래스를 찾을 수는 없습니다.

작동 방법에 대한 아이디어가 있으십니까?

답변

2

XML Getting Started의 문서는이 점에서 구식입니다. CLI를 도구를 구성하는 방법에 대한 설명서의 도구 섹션을 참조하십시오 설명

http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/tools.html

모든 나머지는 여전히 작동합니다. 나는이 부분을 최대한 빨리 업데이트 할 것이다. DoctrineCommon, DoctrineDBAL 및 DoctrineORM : 교리는 세 가지 '교리 2'패키지를 설치할 설치

$ sudo는 배 pear.doctrine-project.org/doctrineORM

배를 사용하여 설치 가정

2

. 우분투에서는이 패키지가/usr/share/php/Doctrine에 있고 doctrine 명령 행 유틸리티가/usr/bin에 설치됩니다.

이 설정으로 사용할 수있는 cli-config.php의 버전입니다 (참고 : DIR에는 앞뒤에 밑줄이 2 개 있어야 표시되지 않음).

<?php 
require ‘Doctrine/ORM/Tools/Setup.php’; 
// Setup Autoloader (1) 
Doctrine\ORM\Tools\Setup::registerAutoloadPEAR(); 

require_once 'Doctrine/Common/ClassLoader.php'; 

$classLoader = new Doctrine\Common\ClassLoader('Entities', __DIR__); 

$classLoader->register(); 

$classLoader = new Doctrine\Common\ClassLoader('Proxies', __DIR__); 

$classLoader->register(); 

$config = new \Doctrine\ORM\Configuration(); 

$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache); 

$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities")); 

$config->setMetadataDriverImpl($driverImpl); 

$config->setProxyDir(__DIR__ . '/Proxies'); 

$config->setProxyNamespace('Proxies'); 

$connectionOptions = array(
     'driver' => 'pdo_mysql', 
     'dbname' => 'bugs', 
     'user' => 'bugs', 
     'password' => 'xyzabc', 
    'host' => 'localhost'); 

$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config); 

$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
    'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 
    'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) 
)); 
관련 문제