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