userDao = $userDao; $this->postDao = $postDao; } public function findByPost(\Szurubooru\Entities\Post $post) { return $this->findBy('postId', $post->getId()); } protected function afterLoad(\Szurubooru\Entities\Entity $comment) { $comment->setLazyLoader( \Szurubooru\Entities\Comment::LAZY_LOADER_USER, function (\Szurubooru\Entities\Comment $comment) { return $this->userDao->findById($comment->getUserId()); }); $comment->setLazyLoader( \Szurubooru\Entities\Comment::LAZY_LOADER_POST, function (\Szurubooru\Entities\Comment $comment) { return $this->postDao->findById($comment->getPostId()); }); } }