final public static function getObjectsByQuery($query, $params=[]) {
		
		$app	= Application::getInstance();
		$db		= Database::getInstance();
		$class	= get_called_class();

		// run query
		$db->setQuery($query);
		$list = $db->loadObjectList($params);
		
		// array that returns and custom binds
		$objects = [];
		$customBinds = [];
		
		if (is_array($list) and isset($list[0])) {
			
			$binds = $class::getBinds();
			
			// get object properties from query
			$fields  = get_object_vars($list[0]);

			// search for custom field names
			foreach ($fields as $field=>$value) {
				if (!array_search($field, $binds)) {
					$customBinds[Utilities::getCamelCase($field)] = $field;
				}
			}

			// build each object
			foreach ($list as $row) {
				
				$object = new $class($row);

				// populate custom properties
				foreach ($customBinds as $customProp=>$customField) {
					$object->$customProp = $row->$customField;
				}
				
				// turn on loaded-from-db flag
				$object->loadedFromDb = TRUE;

				$objects[] = $object;
				
			}
			
		}
		
		$app->logEvent('Loaded ' . count($objects) . ' ' . $class . ' objects with custom fields ' . implode(',', $customBinds));
		
		return $objects;
		
	}
final public static function getObjectsByQuery($query, $params=[]) {
		
		$app	= Application::getInstance();
		$db		= Database::getInstance();
		$class	= get_called_class();

		// run query
		$db->setQuery($query);
		$list = $db->loadObjectList($params);
		
		// array that returns and custom binds
		$objects = [];
		$customBinds = [];
		
		if (is_array($list) and isset($list[0])) {
			
			$binds = $class::getBinds();
			
			// get object properties from query
			$fields  = get_object_vars($list[0]);

			// search for custom field names
			foreach ($fields as $field=>$value) {
				if (!array_search($field, $binds)) {
					$customBinds[Utilities::getCamelCase($field)] = $field;
				}
			}

			// build each object
			foreach ($list as $row) {
				
				$object = new $class($row);

				// populate custom properties
				foreach ($customBinds as $customProp=>$customField) {
					$object->$customProp = $row->$customField;
				}
				
				// turn on loaded-from-db flag
				$object->loadedFromDb = TRUE;

				$objects[] = $object;
				
			}
			
		}
		
		$app->logEvent('Loaded ' . count($objects) . ' ' . $class . ' objects with custom fields ' . implode(',', $customBinds));
		
		return $objects;
		
	}
final public static function getObjectsByQuery ( $ query , $ params = [ ] ) { $ app = Application :: getInstance ( ) ; $ db = Database :: getInstance ( ) ; $ class = get_called_class ( ) ; // run query $ db -> setQuery ( $ query ) ; $ list = $ db -> loadObjectList ( $ params ) ; // array that returns and custom binds $ objects = [ ] ; $ customBinds = [ ] ; if ( is_array ( $ list ) and isset ( $ list [ 0 ] ) ) { $ binds = $ class :: getBinds ( ) ; // get object properties from query $ fields = get_object_vars ( $ list [ 0 ] ) ; // search for custom field names foreach ( $ fields as $ field => $ value ) { if ( ! array_search ( $ field , $ binds ) ) { $ customBinds [ Utilities :: getCamelCase ( $ field ) ] = $ field ; } } // build each object foreach ( $ list as $ row ) { $ object = new $ class ( $ row ) ; // populate custom properties foreach ( $ customBinds as $ customProp => $ customField ) { $ object -> $ customProp = $ row -> $ customField ; } // turn on loaded-from-db flag $ object -> loadedFromDb = TRUE ; $ objects [ ] = $ object ; } } $ app -> logEvent ( 'Loaded ' . count ( $ objects ) . ' ' . $ class . ' objects with custom fields ' . implode ( ',' , $ customBinds ) ) ; return $ objects ; }
Get all objects of inherited class as result of the query run.

@param	string	Query to run.
@param	array	Optional bind parameters for query.

@return	array:mixed
Get all objects of inherited class as result of the query run .