Documentation

Concorde Concepts

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['enable_global_transaction'] 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_exclude_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'.