doctrine magic stuff