2012-11-16 2 views
1

존재하지 않습니다. 프로덕션 서버에 배포 할 때 내 개발 컴퓨터에서 작동하는 코드에서 오류가 발생합니다. 여기 내 컨트롤러 중 하나입니다.Symfony2의 class_parents()는 클래스 내가 Symfony2 응용 프로그램에서 교리 2 테이블에서 데이터를 얻기 위해 노력하고 오류

public function listEntitiesAction($entity, Request $request) 
{  
    $repository = $this->getDoctrine()->getRepository('AALCOInventoryBundle:' . $entity); 
    $metadata = $this->getDoctrine()->getEntityManager()->getClassMetadata('AALCOInventoryBundle:' . $entity); 
    $dataTable = new Datatable($request->query->all(), $repository, $metadata, $this->getDoctrine()->getEntityManager()); 
    $dataTable->makeSearch(); 
    $view = $this->view($dataTable->getSearchResults(), 200) 
      ->setFormat('json'); 
    return $this->get('fos_rest.view_handler')->handle($view); 
} 

위의 코드는 로컬 개발 컴퓨터의 Linux 서버에서 작동합니다. 엔티티 중 하나는 다음과 같습니다.

<?php 
namespace AALCO\InventoryBundle\Entity; 
use Doctrine\ORM\Mapping as ORM; 
/** 
* AALCO\InventoryBundle\Entity\Uom 
* 
* @ORM\Table(name="uoms") 
* @ORM\Entity 
*/ 
class Uom 
{ 
    // entity stuff 
} 

config.yml에서 doctrine에 대한 기본 설정이 있는데 이는 오류입니다. 모든 개체에 대한 php app/console doctrine:mapping:info 반환 OK 실행

request: ErrorException: Warning: class_parents() [<a href='function.class-parents'>function.class-parents</a>]: Class AALCO\InventoryBundle\Entity\uom does not exist and could not be loaded in 
/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php line 40 (uncaught exception) at 
/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php line 40 

. 이 오류에 대한 다른 답변을 확인한 결과 내 특정 문제와 일치하는 항목이 없습니다.

답변

2

Symfony2는 클래스와 파일을로드 자동 로딩을 사용합니다. uow 클래스를 요청하면 uow.php 파일을 찾습니다. 파일 이름은 리눅스 서버에서 대소 문자를 구분하므로, uow.php와 Uow.php는 서로 다른 파일입니다.

당신은지도의 일종을 추가하거나 $entityucfirst 기능을 사용해야합니다.

+0

감사합니다. 당신의 도움으로 문제를 해결했습니다. 그러나 나는 또한 등 실체 "Branch.php", "User.php"와 다른 번들을 가지고 있고,이 오류없이 데이터를 얻을 수 있어요. 왜 그런지 모르겠다. –

관련 문제