Fixed post featuring

This commit is contained in:
Marcin Kurczewski 2014-10-31 23:22:20 +01:00
parent 8f1080717c
commit 7406f76a5a

View file

@ -7,7 +7,7 @@ use Szurubooru\Dao\TransactionManager;
use Szurubooru\Entities\GlobalParam; use Szurubooru\Entities\GlobalParam;
use Szurubooru\Entities\Post; use Szurubooru\Entities\Post;
use Szurubooru\Services\AuthService; use Szurubooru\Services\AuthService;
use Szurubooru\Services\HistoryService; use Szurubooru\Services\PostHistoryService;
use Szurubooru\Services\TimeService; use Szurubooru\Services\TimeService;
use Szurubooru\Validator; use Szurubooru\Validator;
@ -19,7 +19,7 @@ class PostFeatureService
private $globalParamDao; private $globalParamDao;
private $authService; private $authService;
private $timeService; private $timeService;
private $historyService; private $postHistoryService;
public function __construct( public function __construct(
TransactionManager $transactionManager, TransactionManager $transactionManager,
@ -28,7 +28,7 @@ class PostFeatureService
GlobalParamDao $globalParamDao, GlobalParamDao $globalParamDao,
AuthService $authService, AuthService $authService,
TimeService $timeService, TimeService $timeService,
HistoryService $historyService) PostHistoryService $postHistoryService)
{ {
$this->transactionManager = $transactionManager; $this->transactionManager = $transactionManager;
$this->postDao = $postDao; $this->postDao = $postDao;
@ -36,7 +36,7 @@ class PostFeatureService
$this->globalParamDao = $globalParamDao; $this->globalParamDao = $globalParamDao;
$this->authService = $authService; $this->authService = $authService;
$this->timeService = $timeService; $this->timeService = $timeService;
$this->historyService = $historyService; $this->postHistoryService = $postHistoryService;
} }
public function getFeaturedPost() public function getFeaturedPost()
@ -87,8 +87,8 @@ class PostFeatureService
$this->globalParamDao->save($globalParam); $this->globalParamDao->save($globalParam);
if ($previousFeaturedPost) if ($previousFeaturedPost)
$this->historyService->saveSnapshot($this->historyService->getPostChangeSnapshot($previousFeaturedPost)); $this->postHistoryService->savePostChange($previousFeaturedPost);
$this->historyService->saveSnapshot($this->historyService->getPostChangeSnapshot($post)); $this->postHistoryService->savePostChange($post);
}; };
$this->transactionManager->commit($transactionFunc); $this->transactionManager->commit($transactionFunc);
} }