public function one()
{
$object = $this->offsetGet(0);
// execute after the query so we save a query
$count = $this->count();
if ($count === 0) {
throw new NotFoundException("Expected 1 element, found 0");
} elseif ($count > 1) {
throw new ConstraintException("Expected only 1 element, found {$count}");
}
return $object;
}