I'm sorry, I'm not the author of this code. I only refactored this file here : https://github.com/symfony-cmf/MenuBundle/commit/4068da42c53f7ccbd3bf791a9e7d2825d5c81ba8