Private/Polyfony/Database.php
public static function describe(string $table) :array {

		// set the cachefile name
		$cache_name = ucfirst($table).'Nulls';

		// check if it has been cached already
		if(Cache::has($cache_name)) {

			// get it from the cache
			return Cache::get($cache_name);

		}
		// else it is not available from the cache
		else {

			// the list of allowed null columns
			$allowed_nulls = [];

			// query the database
			foreach(self::query()
				->query(str_replace('*table*', $table, self::$_config['nulls']['query']))
				->execute() as $column) {

				// populate the list
				$allowed_nulls[$column->get(self::$_config['nulls']['column_for_name'])] = 
					self::$_config['nulls']['true'] == $column->get(self::$_config['nulls']['column_for_value']) ? true : false;

			}

			// save the results in the cache
			Cache::put($cache_name, $allowed_nulls);

			// and finaly return the results
			return $allowed_nulls;

		}

	}
public static function describe(string $table) :array {

		// set the cachefile name
		$cache_name = ucfirst($table).'Nulls';

		// check if it has been cached already
		if(Cache::has($cache_name)) {

			// get it from the cache
			return Cache::get($cache_name);

		}
		// else it is not available from the cache
		else {

			// the list of allowed null columns
			$allowed_nulls = [];

			// query the database
			foreach(self::query()
				->query(str_replace('*table*', $table, self::$_config['nulls']['query']))
				->execute() as $column) {

				// populate the list
				$allowed_nulls[$column->get(self::$_config['nulls']['column_for_name'])] = 
					self::$_config['nulls']['true'] == $column->get(self::$_config['nulls']['column_for_value']) ? true : false;

			}

			// save the results in the cache
			Cache::put($cache_name, $allowed_nulls);

			// and finaly return the results
			return $allowed_nulls;

		}

	}
public static function describe ( string $ table ) : array { // set the cachefile name $ cache_name = ucfirst ( $ table ) . 'Nulls' ; // check if it has been cached already if ( Cache :: has ( $ cache_name ) ) { // get it from the cache return Cache :: get ( $ cache_name ) ; } // else it is not available from the cache else { // the list of allowed null columns $ allowed_nulls = [ ] ; // query the database foreach ( self :: query ( ) -> query ( str_replace ( '*table*' , $ table , self :: $ _config [ 'nulls' ] [ 'query' ] ) ) -> execute ( ) as $ column ) { // populate the list $ allowed_nulls [ $ column -> get ( self :: $ _config [ 'nulls' ] [ 'column_for_name' ] ) ] = self :: $ _config [ 'nulls' ] [ 'true' ] == $ column -> get ( self :: $ _config [ 'nulls' ] [ 'column_for_value' ] ) ? true : false ; } // save the results in the cache Cache :: put ( $ cache_name , $ allowed_nulls ) ; // and finaly return the results return $ allowed_nulls ; } }
get the description of a table
get the description of a table