2011-09-30 7 views
1

작동하는 앱이 있는데 일부 조명기를 추가하고 싶지만 실제로는 새로운 조명기 파일에로드해야합니다. Symfony 1.4 Doctrine fixtures는 개별 파일을로드합니까?

내가이

php symfony doctrine:data-load 

그것은 이미 데이터베이스에 데이터를 다시 입력합니까 실행합니다. 그렇지 않다면 나는 이것을 단지 호출 할 수 있다고 가정하고 지난 번 이후로 새로운 조명기를 추가 할 것입니다.

모든 데이터를 다시 입력하면 특정 조명기 파일에 데이터로드를 분리 할 수있는 방법이 있습니까?

답변

7

을 작업을 작성하는 방법을 배웠습니다 :

php symfony help doctrine:data-load 
... 


If you want to load data from specific files or directories, you can append 
them as arguments: 

    ./symfony doctrine:data-load data/fixtures/dev data/fixtures/users.yml 
1

당신은 당신이 원하는 일을 모두 할 수있는 -이 개별 설비에로드

당신이 생각을 할 create a new task에 필요는 ... 파일 :

Doctrine_Core::loadData('/path/to/data.yml'); 

이 추가됩니다 비품은 현재 데이터 파일 :

Doctrine_Core::loadData('/path/to/data.yml', true); 

그러니 그냥 새 작업을 생성 - 데이터베이스 연결에 액세스하고 따라 다음 명령 중 하나를 실행 당신이 ...

사과를 수행 할 작업을 아마도 내가 제대로 설명서 ...

당신은 참으로 추가 할 현재의 명령을 사용 및/또는 특정 파일을 사용할 수 있습니다을 읽어야합니다.

Usage: 
symfony doctrine:data-load [--application[="..."]] [--env="..."] [--append] [dir_or_file1] ... [dir_or_fileN] 

Arguments: 
dir_or_file Directory or file to load 

Options: 
--application The application name (default: 1) 
--env   The environment (default: dev) 
--append  Don't delete current data in the database 

Description: 
The doctrine:data-load task loads data fixtures into the database: 

    ./symfony doctrine:data-load 

The task loads data from all the files found in data/fixtures/. 

If you want to load data from specific files or directories, you can append 
them as arguments: 

    ./symfony doctrine:data-load data/fixtures/dev data/fixtures/users.yml 

If you don't want the task to remove existing data in the database, 
use the --append option: 

    ./symfony doctrine:data-load --append 

다시 한 번 당신을 오해의 소지에 대한 사과 ...하지만 그냥 생각 - 당신은 지금 당신이 자세한 설명 될 명령을 befor 문자열 "도움":-)

+0

고마워요.하지만 PHP 파일을 만들고이 코드를 넣고 명령 줄에서 호출하는 것이 좋습니다. php symfony doctrine : data-load –

+0

php symfony 생성 태스크 등을 생성해야합니다 ... doctrine : data-load는 실제로 태스크입니다.이 태스크를 작성할 수 있습니다. 너무 - 작업 내에서 귀하의 명령을 넣어 다음 그것을 실행하십시오 – ManseUK

+0

@DerekOrgan http://www.symfony-project.org/more-with-symfony/1_4/en/13-Leveraging-the-Power-of-the-Command -line # chapter_13_tasks_at_a_glance – ManseUK

관련 문제