public function installRoles()
    {
        $this->_roleService = new erdiko\users\models\Role();

        $results = array(
            "successes" => array(),
            "failures"  => array(),
        );

        foreach($this->_rolesArray as $role) {
            // attempt to create the role
            // wrap this in a try/catch since this throws an exception if failure on create
            $createResult = false;
            try {
                $createResult = (boolean)$this->_roleService->create($role);
            } catch(\Exception $e) {
                // TODO do we need to log this elsewhere?
            }

            if(true !== $createResult) {
                $results["failures"][] = $role;
            } else {
                $results["successes"][] = $role;
            }
        }

        return $results;
    }
public function installRoles()
    {
        $this->_roleService = new erdiko\users\models\Role();

        $results = array(
            "successes" => array(),
            "failures"  => array(),
        );

        foreach($this->_rolesArray as $role) {
            // attempt to create the role
            // wrap this in a try/catch since this throws an exception if failure on create
            $createResult = false;
            try {
                $createResult = (boolean)$this->_roleService->create($role);
            } catch(\Exception $e) {
                // TODO do we need to log this elsewhere?
            }

            if(true !== $createResult) {
                $results["failures"][] = $role;
            } else {
                $results["successes"][] = $role;
            }
        }

        return $results;
    }
public function installRoles ( ) { $ this -> _roleService = new erdiko \ users \ models \ Role ( ) ; $ results = array ( "successes" => array ( ) , "failures" => array ( ) , ) ; foreach ( $ this -> _rolesArray as $ role ) { // attempt to create the role // wrap this in a try/catch since this throws an exception if failure on create $ createResult = false ; try { $ createResult = ( boolean ) $ this -> _roleService -> create ( $ role ) ; } catch ( \ Exception $ e ) { // TODO do we need to log this elsewhere? } if ( true !== $ createResult ) { $ results [ "failures" ] [ ] = $ role ; } else { $ results [ "successes" ] [ ] = $ role ; } } return $ results ; }
loop through the roles array and create records
loop through the roles array and create records