Q&A

모듈 작업 중인데 comment 불러오는 부분에서 문제가 있습니다.

2025.02.19 09:34
108
0
CMS/프레임워크 Rhymix 2.1
개발 언어 PHP 8.4

문제가 발생한 파일

modules/contents/skins/ec_imin/form/file/comment.html

문제 : $oDocument->getComments() 를 불러오면 null 오류가 발생함. (코멘트 있고, 코멘트 갯수는 정상적으로 가져오고 있음)

 

참조하는 파일

1) modules/document/document.item.php - $oDocument->getComments()

2) modules/comment/comment.model.php - CommentModel::getCommentList($this->document_srl, $cpage)

3) modules/document/document.item.php - getCommentCount()

 

추적해보면,

 

1. modules/contents/skins/ec_imin/form/file/comment.html

$oDocument->getCommentCount()

여기서 이건 정상으로 불러옴.

 

2. contents 모듈에서 스킨의 comment.html 에서 $oDocument->getComments() 를 불러오면 오류가 발생함.

원인 모르겠음.

modules/contents/skins/ec_imin/form/file/comment.html $oDocument->getComments() 오류 발생

 

3. modules/document/document.item.php - getComments() 함수에서

$output = CommentModel::getCommentList($this->document_srl, $cpage);

코멘트 모델 참조하고 있음

 

4. modules/comment/comment.model.php - getCommentList() 함수를 보면,

$document_comment_count = $oDocument->getCommentCount(); 참조하고 있음.

 

5. modules/document/document.item.php -> getCommentCount()

function getCommentCount() { return $this->get('comment_count'); }

 

6. 이제 디버깅해보면

comment.model.php:512에서

 

$document_comment_count = $oDocument->getCommentCount(); exit(var_dump("댓글 개수:", $document_comment_count)) 이게 null 로 뜸

//exit(var_dump($oDocument)); // comment_count 인수가 없음..

 

7. 여기서 제 머리가 스파게티가 되었습니다.. ㅠㅠ

어디서 잘못된 걸까요? 

eond Lv. 12

댓글 4

  • 2025.02.19 15:02 #1859640

    스킨상에서 직접적으로 CommentModel을 불러오신다음에 document_srl로 호출해보셨나요?

    코멘트 갯수는 document를 불러올때 같이 불러오던것으로 기억해서 코멘트 갯수가 불러와진다고 코멘트 모듈을 사용할 수 있도록 불러와진건 아닐겁니다.

  • 2025.02.19 19:27 #1859671

    댓글이 있는데도 말씀해주신 방법으로 체크해봐도 댓글이 없다고 뜨네요.

    다른 게시물은 정상적으로 출력이 되는데, 지금 테스트 중인 특정 게시물만 그렇네요 ㅠ

    댓글 자체의 문제가 아니고 해당 게시물에서 확장변수라던가 특이점이 DB 쿼리를 방해하고 있는게 아닌가 싶네요.
    감사합니다.

     

    https://eond.com/xe/473794

  • 2025.02.19 19:35 #1859674
    엄청 이상하네요.. 서드파티 다 꺼가면서 하나씩 원인을 찾아보셔야 할것같습니다.
    화이팅입니다 ㅠㅠ
  • 2025.03.03 04:33 #1901028

    https://rhymix.org/qna/1900939

    modules/comment/comment.model.php:516

    $document_comment_count = $oDocument->getCommentCount();

    이거 검증이 안되서... 안되네요.

    저걸 넘길 방법을 모르겠군요