public function execute(Arguments $args, ConsoleIo $io)
    {
        $this->loadModel('MeCms.UsersGroups');

        $groups = $this->UsersGroups->find()->map(function (UsersGroup $group) {
            return $group->extract(['id', 'name', 'label', 'user_count']);
        });

        //Checks for user groups
        if ($groups->isEmpty()) {
            $io->error(__d('me_cms', 'There are no user groups'));

            return null;
        }

        //Sets header and prints as table
        $header = [I18N_ID, I18N_NAME, I18N_LABEL, I18N_USERS];
        $io->helper('table')->output(array_merge([$header], $groups->toList()));

        return null;
    }
public function execute(Arguments $args, ConsoleIo $io)
    {
        $this->loadModel('MeCms.UsersGroups');

        $groups = $this->UsersGroups->find()->map(function (UsersGroup $group) {
            return $group->extract(['id', 'name', 'label', 'user_count']);
        });

        //Checks for user groups
        if ($groups->isEmpty()) {
            $io->error(__d('me_cms', 'There are no user groups'));

            return null;
        }

        //Sets header and prints as table
        $header = [I18N_ID, I18N_NAME, I18N_LABEL, I18N_USERS];
        $io->helper('table')->output(array_merge([$header], $groups->toList()));

        return null;
    }
public function execute ( Arguments $ args , ConsoleIo $ io ) { $ this -> loadModel ( 'MeCms.UsersGroups' ) ; $ groups = $ this -> UsersGroups -> find ( ) -> map ( function ( UsersGroup $ group ) { return $ group -> extract ( [ 'id' , 'name' , 'label' , 'user_count' ] ) ; } ) ; //Checks for user groups if ( $ groups -> isEmpty ( ) ) { $ io -> error ( __d ( 'me_cms' , 'There are no user groups' ) ) ; return null ; } //Sets header and prints as table $ header = [ I18N_ID , I18N_NAME , I18N_LABEL , I18N_USERS ] ; $ io -> helper ( 'table' ) -> output ( array_merge ( [ $ header ] , $ groups -> toList ( ) ) ) ; return null ; }
Lists user groups
@param Arguments $args The command arguments
@param ConsoleIo $io The console io
@return null|int The exit code or null for success
Lists user groups