1<?php
// A single user by its nickname
$user = $em->getRepository('MyProjectDomainUser')->findOneBy(array('nickname' => 'romanb'));
// A single user by its nickname (__call magic)
$user = $em->getRepository('MyProjectDomainUser')->findOneByNickname('romanb');