Implemented polymorphic hasOne

Signed-off-by: Fabien Franzen <info@atelierfabien.be>