Skip to content

Instantly share code, notes, and snippets.

@jacobsenj
Created December 12, 2013 13:29
Show Gist options
  • Select an option

  • Save jacobsenj/7927932 to your computer and use it in GitHub Desktop.

Select an option

Save jacobsenj/7927932 to your computer and use it in GitHub Desktop.
Repository Method to get MAX + 1 of a number field within the entity
/**
* @return int
*/
public function getNextNumber()
{
return $this->getEntityManager()->createQuery('SELECT MAX(n.number) + 1 AS number FROM Application\Entity\Name n')->getSingleScalarResult();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment