Docs - Table
The table is called by the model to get all the data from the adapter(server). However this isn’t the only thing the controller will/ can do.
Within the table object it is possible to override the default identity_column and to provide a column map more on this later.
Raddish is based on naming conventions. This goes as well for the database tables.
The basic name for the tables are
<component_name>_<plural_view_name> eg: articles_articles. This is without the optional prefix,
if you have a prefix this has to be prepended.
The ID of the column als has a specific naming convention. This has to be:
Also this column needs to to be the primary key and auto increment.
If no config values are given for the table name or the identity_column, these values are assumed as explained above. Next to this the filters for the columns in the table are assumed based on the value of the column.
The columns available in the table are used in the row and rowset objects.
Also the parsed data will present these values. The only exception is the
identity column this column will be presented as
Changing the filters
Filters can be changed on two levels. The table level itself as a comment on the column like
@Filter('<filter_value>') of in the filter object in the table.
Within Raddish it is possible to add behaviors to the table object.
The behaviors are added in a special subfolder in the table folder called behavior.
In a behavior object you can bind on before and after methods. In the table the following methods are available:
All of these methods will get an context. onBefore methods have an query object and onAfter methods will have the raw data from the database.
Here you can add DCI or your own reusable code. More on behaviors.
In this example we will set some values and we will show the component config values.