Example 6: delete

The method 'convert_row()' converts each item of the row given the array $config['artefact_data_conv']
in ./application/config/config_artefact.php.
Each item must have the format 'alias_name:field_name' (or 'table_name:field_name' if there is no alias).
If you want the method 'convert_row()' not to convert an item, you have to write ':item_name'.
Example: $qm->select('article_tag.created_at AS :created_at')

All the functions available in the CodeIgniter Query builder are also
available in the Query manager (where(), group_start(), like() ...).

Example 7: Get the paragraphs whose position is 2, using alias

Example 8: Get the root folders (i.e., folders that have no parent folder), using alias and recursivity

Folder is a Model which has a recursive property 'subfolders' (the opposite property is 'parent_folder').
The recursive field in the database is 'parent_id'.
The definition of the association in the array $config['artefact_mapping_associations']
of the file ./application/config/config_artefact.php
is:

Example 4

Example 5

$new_title = $main_databubble->insert_model(
'Title',
array(
'content' => 'The content of the new title',
)
);
$new_title->set_assoc('article', $article, false);
// In this example, a save() is required because in the previous line,
// we set the third parameter $auto_commit to false.
$new_title->save();

Association

Regarding the functions, it is identical to the Model,
except that only the functions set(), add() and remove() are available.

Enum model

An Enum model is a special type of Model.
It is similar to the 'ENUM' field type in a database.
So, the data of an Enum model are immutable, except when you upgrade the application.

An Enum model always has at least two properties: 'id' and 'name'.

The property 'name' refers to an internal name, so it is recommended not to use spaces or special characters.
If you want to store a name that will be displayed, you can add an extra field (for example 'displayed_name').

Instead of using the 'ENUM' field type, you should use the Enum_model concept because it is more flexible and scalable
(you can easily add a new property).

You can find a full example
here.
In this example, the Enum model 'Status' has an extra property 'color'.

An Enum model property (for example the property 'status' in the Model
Article)
is considered as a basic property (and not as an association property),
so it is automatically retrieved from the database (no need to specify something in the function with())
and it is recommended not to suffix the related database field with '_id'.