Model in Batoi RAD Framework


Model refers to the business logic part of the application. This consists of application classes and script includes. All files of Model are stored in /model directory.

An Application Class refers to any PHP class that contains the business logic of the application and is a part of Model. Application classes can be created and managed directly through the Batoi RAD Framework IDE. However, you can also edit these classes in your favorite code editor. These classes are located in /model/class directory.

NOTE:

  1. The filename of an Application Class should be exactly the same as class name but should have extension as .cls.php. There should be no white space in the class name or in the corresponding filename.
  2. Do not create the name of Application Class equal to the Batoi RAD Framework library class which always starts with Delight_
  3. There is no need to include Application Class files as the classes are autoloaded.

A Script Include refers to any PHP file that contains the business logic of the application and is a part of Model. This file is included in an event to execute respective business logic. Script Includes can be created and managed directly through the Batoi RAD Framework IDE. However, you can also edit these files in your favorite code editor. These files are located in /model/script directory. The filename of a Script Include should have file extension as .inc.php.

The other thing that you can manage about Model is the Configuration Variables of application. While developing an application, we tend to use a number of magic numbers. Ideally, we store these in a separate file, and in turn, include it every time within the application. With the Batoi RAD Framework, we do not need to do any such effort; rather we create these as configuration variables on the Batoi RAD Framework IDE, and then use them as a property (date type is an associative array) of $APP object, $APP->CONFIG, within the application. You can add a Configuration Variable by filling SVariable Name, Description, and Value of Variable on the Batoi RAD Framework IDE. You can arrange the display order of the created variables; however, this is just for display purpose on the Batoi RAD Framework IDE (for readability of list of variables for developer), and do not have any other requirement during application development.