Refactored hasParent and hasChildren

Code refactoring to avoid deprecated calls with symfony2.1 / 2.2.