src/User.php
public function create($vals)
	{
		$this->debug->groupCollapsed(__METHOD__);
		$return = array(
			'success' => true,
			'errorDesc' => '',
			'userid' => null,
		);
		$noQuoteCols = array(
			'createdon',
			'lastactivity',
		);
		$vals = array_change_key_case($vals);
		$vals['createdon']		= 'NOW()';
		$vals['lastactivity']	= 'NOW()';
		$valsOther = array();
		$cols = $this->db->getColProperties('user');
		$this->debug->table($cols, 'cols');
		$col_names = array_keys($cols);
		foreach ($vals as $k => $v) {
			if (isset($this->cfg['userForeignKeys'][$k])) {
				$fka = $this->cfg['userForeignKeys'][$k];
				$k_new = $fka['userCol'];
				$v_new = Str::quickTemp('('.$fka['getValQuery'].')', array('value'=>$this->db->quoteValue($v)));
				unset($vals[$k]);
				$vals[$k_new] = $v_new;
				$noQuoteCols[] = $k_new;
			} elseif (!in_array($k, $col_names)) {
				$valsOther[$k] = $v;
				unset($vals[$k]);
			}
		}
		$result = $this->db->rowMan('user', $vals, null, $noQuoteCols);
		$this->debug->log('result', $result);
		if ($result) {
			$this->debug->info('user created');
			$userid = $result;
			$this->log('userCreate', $userid);
			if (!empty($valsOther)) {
				$return = $this->update($valsOther, $userid);
			}
			$return['userid'] = $userid;
		} else {
			$return['success'] = false;
			$return['errorDesc'] = $this->db->error;
		}
		$this->debug->log('return', $return);
		$this->debug->groupEnd();
		return $return;
	}
public function create($vals)
	{
		$this->debug->groupCollapsed(__METHOD__);
		$return = array(
			'success' => true,
			'errorDesc' => '',
			'userid' => null,
		);
		$noQuoteCols = array(
			'createdon',
			'lastactivity',
		);
		$vals = array_change_key_case($vals);
		$vals['createdon']		= 'NOW()';
		$vals['lastactivity']	= 'NOW()';
		$valsOther = array();
		$cols = $this->db->getColProperties('user');
		$this->debug->table($cols, 'cols');
		$col_names = array_keys($cols);
		foreach ($vals as $k => $v) {
			if (isset($this->cfg['userForeignKeys'][$k])) {
				$fka = $this->cfg['userForeignKeys'][$k];
				$k_new = $fka['userCol'];
				$v_new = Str::quickTemp('('.$fka['getValQuery'].')', array('value'=>$this->db->quoteValue($v)));
				unset($vals[$k]);
				$vals[$k_new] = $v_new;
				$noQuoteCols[] = $k_new;
			} elseif (!in_array($k, $col_names)) {
				$valsOther[$k] = $v;
				unset($vals[$k]);
			}
		}
		$result = $this->db->rowMan('user', $vals, null, $noQuoteCols);
		$this->debug->log('result', $result);
		if ($result) {
			$this->debug->info('user created');
			$userid = $result;
			$this->log('userCreate', $userid);
			if (!empty($valsOther)) {
				$return = $this->update($valsOther, $userid);
			}
			$return['userid'] = $userid;
		} else {
			$return['success'] = false;
			$return['errorDesc'] = $this->db->error;
		}
		$this->debug->log('return', $return);
		$this->debug->groupEnd();
		return $return;
	}
public function create ( $ vals ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ return = array ( 'success' => true , 'errorDesc' => '' , 'userid' => null , ) ; $ noQuoteCols = array ( 'createdon' , 'lastactivity' , ) ; $ vals = array_change_key_case ( $ vals ) ; $ vals [ 'createdon' ] = 'NOW()' ; $ vals [ 'lastactivity' ] = 'NOW()' ; $ valsOther = array ( ) ; $ cols = $ this -> db -> getColProperties ( 'user' ) ; $ this -> debug -> table ( $ cols , 'cols' ) ; $ col_names = array_keys ( $ cols ) ; foreach ( $ vals as $ k => $ v ) { if ( isset ( $ this -> cfg [ 'userForeignKeys' ] [ $ k ] ) ) { $ fka = $ this -> cfg [ 'userForeignKeys' ] [ $ k ] ; $ k_new = $ fka [ 'userCol' ] ; $ v_new = Str :: quickTemp ( '(' . $ fka [ 'getValQuery' ] . ')' , array ( 'value' => $ this -> db -> quoteValue ( $ v ) ) ) ; unset ( $ vals [ $ k ] ) ; $ vals [ $ k_new ] = $ v_new ; $ noQuoteCols [ ] = $ k_new ; } elseif ( ! in_array ( $ k , $ col_names ) ) { $ valsOther [ $ k ] = $ v ; unset ( $ vals [ $ k ] ) ; } } $ result = $ this -> db -> rowMan ( 'user' , $ vals , null , $ noQuoteCols ) ; $ this -> debug -> log ( 'result' , $ result ) ; if ( $ result ) { $ this -> debug -> info ( 'user created' ) ; $ userid = $ result ; $ this -> log ( 'userCreate' , $ userid ) ; if ( ! empty ( $ valsOther ) ) { $ return = $ this -> update ( $ valsOther , $ userid ) ; } $ return [ 'userid' ] = $ userid ; } else { $ return [ 'success' ] = false ; $ return [ 'errorDesc' ] = $ this -> db -> error ; } $ this -> debug -> log ( 'return' , $ return ) ; $ this -> debug -> groupEnd ( ) ; return $ return ; }
Creates user in DB
Does NOT load user into current session

@param array $vals values

@return array
Creates user in DB Does NOT load user into current session