메뉴 건너뛰기

게시판 모듈의 함수 하나를 다른 플러그인에서 덮어쓰는 방법

게시판 조회수 중복이 가능하도록 수정해보려 합니다.

 

기본 게시판기능이 업글되면 가능키는 하나....... 한번 별도 플러그인에서 다른 플러그인 함수를 덮어쓰는게 가능한지 궁금합니다.

 

public function incrementReadCount(Board $board, UserInterface $user)
{
    if ($this->readCounter->has($board->id, $user) === false) {
        //$this->readCounter->add($board->id, $user);
    }
    $this->readCounter->add($board->id, $user); // 무조건 조회수 증가

    $board->read_count = $this->readCounter->getPoint($board->id);
    $board->timestamps = false;
    $board->save();
}

 

기본 board 플러그인의 위 소스를 직접 고치는게 아니라

다른 플러그인에서 위 함수를 등록해놓고 이걸 부르게 가능할지요??

설명글에 있는 인터셉트.. 기능으로 하면 될것같긴한데 어려워서.. 힌트부탁드립니다

 

  • share