Controller/GroupController.php
protected function findGroupBy($key, $value)
    {
        if (!empty($value)) {
            $group = $this->get('fos_user.group_manager')->{'findGroupBy'.ucfirst($key)}($value);
        }

        if (empty($group)) {
            throw new NotFoundHttpException(sprintf('The group with "%s" does not exist for value "%s"', $key, $value));
        }

        return $group;
    }
protected function findGroupBy($key, $value)
    {
        if (!empty($value)) {
            $group = $this->get('fos_user.group_manager')->{'findGroupBy'.ucfirst($key)}($value);
        }

        if (empty($group)) {
            throw new NotFoundHttpException(sprintf('The group with "%s" does not exist for value "%s"', $key, $value));
        }

        return $group;
    }
protected function findGroupBy ( $ key , $ value ) { if ( ! empty ( $ value ) ) { $ group = $ this -> get ( 'fos_user.group_manager' ) -> { 'findGroupBy' . ucfirst ( $ key ) } ( $ value ) ; } if ( empty ( $ group ) ) { throw new NotFoundHttpException ( sprintf ( 'The group with "%s" does not exist for value "%s"' , $ key , $ value ) ) ; } return $ group ; }
Find a group by a specific property

@param string $key   property name
@param mixed  $value property value

@throws NotFoundHttpException                if user does not exist
@return \FOS\UserBundle\Model\GroupInterface
Find a group by a specific property