Refactored hasParent and hasChildren

Code refactoring to avoid deprecated calls with symfony2.1 / 2.2.
For better readability avoided not clauses
Merge pull request #396 from peterrehm/patch-5

Refactoring for Symfony 2.1/2.2 compatibility