public function findOneBy(array $criteria)
{
$em = $this->getEntityManager();
$storage = $em->getStorage($this->getReflectionClassName());
foreach ($storage as $obj) {
$c = true;
foreach ($criteria as $propertyName => $value) {
$fn = 'get' . ucfirst($propertyName);
if ($obj->{$fn}() !== $value) {
$c = false;
break;
}
}
if ($c === true) {
return $obj;
}
}
return null;
}