Documentation

Concorde Concepts

Configuration management

The main configuration file is config.php and its section (called 'primary section') is 'Config'.
An additional configuration file may have its own section by defining a variable $section in the file.

Function reference

The argument $item can be a string like 'parameter' or 'Section.parameter'.
It can also be an array with two keys : 'section' and 'parameter'.
If the section is not defined, then it is set to the primary section 'Config'.
  • section_exists($section)
    Return TRUE if the config section $section exists and FALSE otherwise
    Example: $CI->config->section_exists('Section')
  • item_exists($item)
    Return TRUE if the config item $item exists and FALSE otherwise
    Example: $CI->config->item_exists('Section.parameter')
  • section($section = CONFIG_PRIMARY_SECTION)
    Fetch a config section
    The config section $section must be defined, otherwise an exception is thrown.
    Example: $CI->config->section('Section')
  • item($item)
    Fetch a config item
    The config item $item must be defined, otherwise an exception is thrown.
    Example: $CI->config->item('Section.parameter')
  • slash_item($item)
    Fetch a config item with slash appended (if not empty)
    The config item $item must be defined, otherwise an exception is thrown.
    Example: $CI->config->slash_item('Section.parameter')
  • create_item($item, $value)
    Create a config item
    If the config item $item already exists, then it is overwritten.
    Example: $CI->config->create_item('Section.parameter', 'value')
  • set_item($item, $value)
    Set a config item
    The config item $item must be defined, otherwise an exception is thrown.
    Example: $CI->config->set_item('Section.parameter', 'value')
  • restore_item($item)
    Restore the value of the config item $item to its initial value
    The config item $item must be defined, otherwise an exception is thrown.
    Example: $CI->config->restore_item('Section.parameter')
  • delete_item($item)
    Delete a config item
    The config item $item must be defined, otherwise an exception is thrown.
    Example: $CI->config->delete_item('Section.parameter')
  • create_section($section = CONFIG_PRIMARY_SECTION)
    Create a config section
    The config section $section must not be defined yet, otherwise an exception is thrown.
    Example: $CI->config->create_section('Section')
  • restore_section($section = CONFIG_PRIMARY_SECTION)
    Restore the config section $section
    The config section $section must be defined, otherwise an exception is thrown.
    Example: $CI->config->restore_section('Section')
  • delete_section($section = CONFIG_PRIMARY_SECTION)
    Delete a config section
    The config section $section must be defined, otherwise an exception is thrown.
    Example: $CI->config->delete_section('Section')
  • restore()
    Restore all the config sections
    Example: $CI->config->restore()

Namespaces management

In the file ./application/config/config.php, the item $config['application_namespace'] corresponds to the folder ./application and the item $config['classes_autoload'] is an array of callables that are passed to the spl_autoload_register() function.

Global transaction

In the file ./application/config/config.php, if the item $config['global_transaction_enabled'] is set to TRUE, it means that at the beginning of all HTTP requests (except for the URIs listed in the item $config['global_transaction_excluded_uris']), an SQL transaction starts.
This transaction is committed at the end of the HTTP request (except if a commit/rollback has been processed before).

Datetime wrappers

The datetime wrappers are located here.

The PostgreSQL datetime wrappers are:

  • Pgsql_date
  • Pgsql_interval
  • Pgsql_time
  • Pgsql_timetz
  • Pgsql_timestamp
  • Pgsql_timestamptz
The MySQL datetime wrappers are:
  • Mysql_date
  • Mysql_datetime
  • Mysql_interval
  • Mysql_time
  • Mysql_timestamp
  • Mysql_year
Each datetime wrapper corresponds to a database field type.

Function reference for all the datetime wrappers

  • get_value()
    Get the value of the datetime wrapper in string format
  • convert()
    Convert the value of the datetime wrapper into a DateTime or DateInterval object
  • db_format()
    Get the value of the datetime wrapper formatted for the database
  • format($format)
    Format the value of the datetime wrapper given the format $format
    Example: $data->format('d/m/Y H:i')
  • compare_to(Dbms_datetime $arg1)
    Compare the current Dbms_datetime to the Dbms_datetime $arg1
    Return:
    • 0 if the current Dbms_datetime is equal to the Dbms_datetime $arg1
    • 1 if the current Dbms_datetime is greater than the Dbms_datetime $arg1
    • -1 if the current Dbms_datetime is less than the Dbms_datetime $arg1
  • equals(Dbms_datetime $arg1)
    Return true if the current Dbms_datetime equals the Dbms_datetime $arg1 and false otherwise

Additional function reference for all the datetime wrappers except Pgsql_interval and Mysql_interval

  • The constructor: __construct($value = 'now')
    The parameter $value can be:
    • the string 'now'
    • a DateTime object
    • a data used to set the value of the datetime wrapper
  • static create_from_format($format, $time)
    Create an object given the format $format and the time $time
  • And the four functions diff(), add(), sub() and modify() (similar to the DateTime functions)

Additional function reference for Pgsql_interval and Mysql_interval

  • The constructor: __construct($value)
    The parameter $value can be:
    • a DateInterval object
    • a data used to set the value of the datetime wrapper
  • static create_from_date_string($time)
    Create a Pgsql_interval or Mysql_interval object given the time $time
    See https://www.php.net/manual/en/dateinterval.createfromdatestring.php
  • static create(\DateTime $datetime_1, \DateTime $datetime_2, $absolute = false)
    Only for Mysql_interval
    Create a Mysql_interval object that is the difference between $datetime_1 and $datetime_2

Now class

The Now class is located here.
It is a singleton which means that each time you call 'Now::get_singleton()', you get the same Now instance.

Example 1:

    $now = Now::get_singleton()->get_value();

    $article = Article::find(2);
    $article->set('created_at', new Pgsql_timestamptz($now))
            ->save();
                

Function reference

  • get_value(): DateTime
    Get the value of the current Now instance
  • reset()
    Reset the current Now instance

Undefined class

The Undefined class is located here.
It is equivalent to the 'undefined' of JavaScript.
The function is_undefined() checks if a variable is 'undefined'.