2012-01-17 2 views
2

Gedmo Translatable Extension을 Doctrine 2.2/Zend에 통합하려고했지만 성공하지 못했으며 도움이 필요했습니다. 항상 치명적인 오류가 발생합니다 :Gedmo Doctrine 2.2/Zend의 번역 가능 통합

Uncaught exception 'Doctrine\ORM\Mapping\MappingException' with message 'Class AliasStaticPage is not a valid entity or mapped super class.' in[...]library/Doctrine/ORM/Mapping/MappingException.php:147

APC가 실행 중이고 Doctrine 2.2가 (이전에) 잘 작동했습니다.

은 ( Best practices for setting up with annotations 유사) 내 부트 스트랩입니다 :

<?php 
use Doctrine\ORM\Mapping\Id; 
use Doctrine\ORM\Mapping as ORM; 

/** 
* @ORM\Entity 
* @ORM\Table(name="alias") 
* @ORM\InheritanceType("JOINED") 
* @ORM\DiscriminatorMap({"aliasProject" = "AliasProject",      
*     "aliasStaticPage" = "AliasStaticPage"}) 
*/ 
abstract class Alias 
{ 
/** 
* @Id 
* @ORM\Column(type="integer") 
* @ORM\GeneratedValue(strategy="AUTO") 
*/ 
private $id; 
[...] 
} 

그리고 결합 된 클래스 :

<?php 
use Doctrine\ORM\Mapping\Id; 
use Doctrine\ORM\Mapping as ORM; 

/** 
* @ORM\Entity 
* @ORM\Table(name="aliasStaticPage") 
*/ 
class AliasStaticPage extends Alias 
{ 

/** 
* @ManyToOne(targetEntity="StaticPage") 
* @JoinColumns({@JoinColumn(name="staticPage_id", referencedColumnName="id")}) 
*/ 
private $staticPage; 
[...] 
} 

I

$cache = new \Doctrine\Common\Cache\ApcCache();  
    $config->setQueryCacheImpl($cache); 
    $config->setResultCacheImpl($cache); 
    $config->setMetadataCacheImpl($cache); 

    $config->setProxyNamespace('App\Proxies'); 

    $annotationReader = new Doctrine\Common\Annotations\AnnotationReader(); 

    Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
     'Gedmo\Mapping\Annotation', 
     '../library/DoctrineExtensions/Gedmo' 
    ); 
    Doctrine\Common\Annotations\AnnotationRegistry::registerFile(
     '../library/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php' 
    ); 

    $chainDriverImpl = new \Doctrine\ORM\Mapping\Driver\DriverChain();  
    $annotationDriver = new Doctrine\ORM\Mapping\Driver\AnnotationDriver($annotationReader, 
      array(
      APPLICATION_PATH . '/models', 
      '../library/DoctrineExtensions/Gedmo/Translatable/Entity' 
      )); 
    $chainDriverImpl->addDriver($annotationDriver, 'Entity'); 
    $chainDriverImpl->addDriver($annotationDriver, 'Gedmo\Translatable\Entity'); 

    $config->setMetaDataDriverImpl($chainDriverImpl); 

여기에 클래스 정의의 일부입니다 성공하지 않고 doctrine-project.org에서이 접근법을 시도했습니다 ...

아이디어에 감사드립니다. .. 왜 모르는이 방법은 같은 객체의 해시에 93에서 \ 교리 \ ORM \ 매핑 \ 드라이버 \의 DriverChain 내 이끄는 AnnotationDriver을 구현

하지만, 그것은 단지 루프 : 그래서 여기

+0

해결할 수 있지만 4 시간 전까지는 내 솔루션에 응답 할 수 없습니다. – theColaKid

답변

0

내 솔루션입니다 일단. 그래서 내가 2 annotationDrivers의 Gedmo 엔티티 내 모델 하나 하나에 분할 : 추가 된 드라이버의 네임 스페이스 내 공간에 적합하지 않은

$annotationReader = new Doctrine\Common\Annotations\AnnotationReader(); 
$annotationDriver1 = new Doctrine\ORM\Mapping\Driver\AnnotationDriver($annotationReader, array('../library/DoctrineExtensions/Gedmo/Translatable/Entity')); 
$annotationDriver2 = new Doctrine\ORM\Mapping\Driver\AnnotationDriver($annotationReader, array(APPLICATION_PATH . '/models')); 

$chainDriverImpl = new \Doctrine\ORM\Mapping\Driver\DriverChain(); 
$chainDriverImpl->addDriver($annotationDriver1, 'Gedmo\Translatable\Entity'); 
$chainDriverImpl->addDriver($annotationDriver2, 'Model'); 

다음, 즉 클래스로보고 결국 결코 방법 . 또한 모든 ManyToOne, Join에 @ORM \ 접두어를 추가해야했습니다.

그리고 그게 전부입니다. 희망이 같은 상황에서 다른 사람을 도울 수 있기를 바랍니다.

관련 문제