You should invert the last two lines:
$story = $comment->getStory();
$project = $story->getProject();