common/services/base/ActiveRecordService.php
public static function generateMap( $config = [] ) {

		$parentType = static::$parentType;

		// column alias
		$defaultValue	= preg_replace( '/-/', ' ', $parentType );
		$default		= $config[ 'default' ] ?? false;
		$defaultValue	= $config[ 'defaultValue' ] ?? ucfirst( $defaultValue );

		$nameAlias		= $config[ 'nameAlias' ] ?? 'name';
		$valueAlias		= $config[ 'valueAlias' ] ?? 'value';

		$arrayList		= static::generateNameValueList( $config );
		$map			= $default ? [ '0' => "Choose $defaultValue" ] : [];

		foreach( $arrayList as $item ) {

			$map[ $item[ $nameAlias ] ] = $item[ $valueAlias ];
		}

		return $map;
	}
public static function generateMap( $config = [] ) {

		$parentType = static::$parentType;

		// column alias
		$defaultValue	= preg_replace( '/-/', ' ', $parentType );
		$default		= $config[ 'default' ] ?? false;
		$defaultValue	= $config[ 'defaultValue' ] ?? ucfirst( $defaultValue );

		$nameAlias		= $config[ 'nameAlias' ] ?? 'name';
		$valueAlias		= $config[ 'valueAlias' ] ?? 'value';

		$arrayList		= static::generateNameValueList( $config );
		$map			= $default ? [ '0' => "Choose $defaultValue" ] : [];

		foreach( $arrayList as $item ) {

			$map[ $item[ $nameAlias ] ] = $item[ $valueAlias ];
		}

		return $map;
	}
public static function generateMap ( $ config = [ ] ) { $ parentType = static :: $ parentType ; // column alias $ defaultValue = preg_replace ( '/-/' , ' ' , $ parentType ) ; $ default = $ config [ 'default' ] ?? false ; $ defaultValue = $ config [ 'defaultValue' ] ?? ucfirst ( $ defaultValue ) ; $ nameAlias = $ config [ 'nameAlias' ] ?? 'name' ; $ valueAlias = $ config [ 'valueAlias' ] ?? 'value' ; $ arrayList = static :: generateNameValueList ( $ config ) ; $ map = $ default ? [ '0' => "Choose $defaultValue" ] : [ ] ; foreach ( $ arrayList as $ item ) { $ map [ $ item [ $ nameAlias ] ] = $ item [ $ valueAlias ] ; } return $ map ; }
The method findMap returns an associative array for the defined table and columns. It also apply the provided conditions.
@param array $config
@return array - associative array of arrays having name as key and value as value.
The method findMap returns an associative array for the defined table and columns . It also apply the provided conditions .