본문 바로가기
MySql

MySQL Symfony2 Doctrine을 사용하여 기존 데이터베이스에서 엔티티 가져 오기

by 베이스 공부 2020. 12. 23.
반응형



root@khs01wxl001:/var/www/organizer$ php app/console doctrine:mapping:import --force organizerscheduleBundle php
Importing mapping information from "default" entity manager
  > writing /var/www/organizer/src/organizer/scheduleBundle/Resources/config/doctrine/Dept.orm.php
  > writing /var/www/organizer/src/organizer/scheduleBundle/Resources/config/doctrine/Desg.orm.php
  > writing /var/www/organizer/src/organizer/scheduleBundle/Resources/config/doctrine/Dir.orm.php
  > writing /var/www/organizer/src/organizer/scheduleBundle/Resources/config/doctrine/Schedule.orm.php
  > writing /var/www/organizer/src/organizer/scheduleBundle/Resources/config/doctrine/Username.orm.php
  > writing /var/www/organizer/src/organizer/scheduleBundle/Resources/config/doctrine/Userrole.orm.php
root@khs01wxl001:/var/www/organizer$

지금까지는 훌륭했지만 이제 "다음 두 명령을 실행하여 관련 엔티티 클래스를 빌드하도록 Doctrine에 요청할 수 있습니다.

$ php app/console doctrine:mapping:convert annotation ./src
$ php app/console doctrine:generate:entities AcmeBlogBundle

그러나 내가 그것을 할 때 첫 번째 것은 나를 위해 작동하지 않습니다.

root@khs01wxl001:/var/www/organizer$ php app/console doctrine:mapping:convert annotation ./src/organizer/scheduleBundle/Resources/config/doctrine/
No Metadata Classes to process.
root@khs01wxl001:/var/www/organizer$

어떠한 제안?

 

해결 방법

 

시도해보십시오 :

# write the structure to annotation file (I prefear to use YML instead annotation but should be the same) 
$ php app/console doctrine:mapping:convert annotation ./src/organizer/scheduleBundle/Resources/config/doctrine/metadata/orm --from-database --force

# Import the structure
$ php app/console doctrine:mapping:import organizerscheduleBundle annotation

# Generate Entities file class
$ php app/console doctrine:generate:entities organizerscheduleBundle 

여기에 더 많은 문서 :


모두 수입되는 것은 아닙니다 (문서는 70-80 %라고 말하지만 제 생각에는 더 적습니다).

추신. 가장 좋은 방법은 조직자를 회사 이름으로 사용하여 번들 OrganizerSchedule Bundle (대문자 모양)을 호출하는 것이므로 개발자 / 회사 이름 폴더 안에 모든 번들이 있습니다.

 

참조 페이지 https://stackoverflow.com/questions/18651764

 

 

반응형

댓글