This isn't something that can be explained in-universe, because the two works don't take place in the same universe. There are lots of other differences: Bean and Ender are in the same launch group is a very obvious one. Another is that there was no Second Invasion (or no First Invasion?). And no one uses the word "bugger" at all, only "Formic", despite the fact that the former is used frequently in the book.
Since there are some basic facts that are different between the two universes, it's impossible to come up with an in-universe explanation for their differences. It's like asking "In-universe, why does Professor X look so much like Captain Picard?"
To answer some comments other people made about "7 years", I don't think that's too far off for an estimate of the entire length of the book.
When Ender is transferred to Salamander, he states his age very exactly:
The boy took the paper in a swift, sure movement, without touching Ender's hand. "How old are you, Wiggin?" he asked.
Still quietly, he said, "I asked how old you are, not how old you almost are.”
"I am six years, nine months, and twelve days old.”
By the time he's transferred to Command School, he's just over 10. While goading Bonzo into fighting him alone, he says:
"Yes, I beat up Ender Wiggin, who was barely ten years old, and I was thirteen."
At the end, when Val told him about Demosthenes and the colony ship:
"You're telling everyone that you're Demosthenes? A fourteen-year-old girl?”
We don't know Val's exact age at the start of the book, but she was older than Ender. So he's probably 13 or less. So he probably spends somewhere from 5-7 years altogether in training.