Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document division 처리 코드 수정 #399

Closed
akasima opened this issue Feb 28, 2017 · 0 comments
Closed

Document division 처리 코드 수정 #399

akasima opened this issue Feb 28, 2017 · 0 comments
Assignees
Milestone

Comments

@akasima
Copy link
Member

akasima commented Feb 28, 2017

Document 를 사용하는 플러그인들이 테이블 분리 설정(Division)을 사용할 수 있습니다.
테이블 분리 설정 지원을 위해 Document Model에 설정(XeConfig ConfigEntity)을 주입하는 방식으로 처리했는데 이로 인해 코드가 정신없이 꼬여버렸습니다.

DocumentHandler를 통해 모델 객체를 받고 또 그 모델에 ConfingEntity를 주입하는 코드를 작성해야해서 Document를 사용하는 플러그인에서 버그 발생이 많았습니다.

이런 문제를 개선하기 위해 ConfigEntity 를 Model 에 주입하는 방식을 수정하려고 합니다.

아래는 수정 이전의 Document 사용 방법 입니다.

모델에 Config 를 주입하기위해 DocumentHandler 를 통해 Model 획득


문서 수정

$model = XeDocument::getModel('instance-id');
$doc = $model->find('document-id');

$doc->title = 'changed title';

XeDocument::update($doc);

문서 삭제

$model = XeDocument::getModel('instance-id');
$doc = $model->find('document-id');

XeDocument::remove($doc);

문서 조회

$model = XeDocument::getModel('instance-id');
$doc = $model->find('document-id');

$doc = XeDocument::get('document-id', 'instance-id');
// instance id 를 넘겨주지 않으면 항상 documents table 에서 조회
$doc = XeDocument::get('document-id');

관련 이슈
xpressengine/plugin-board#81
xpressengine/plugin-comment#19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant