Boars are very smart. If just 1 got out of the cage, he would tell the other boars about what happened, then no boar would eat below a cage again.
That said, this idea would have some longevity if used in MineCraft.
If you watch the gif carefully you can see that one piglet did escape.
watch at what would be 11:00 early after the trap falls