sene_model Class

The sene_model is an abstract class serves as a foundation for creating database models in the Seme Framework. It provides a basic structure for interacting with databases, including loading the database engine configuration and providing methods for encrypting and decrypting strings.

Class Synopsis

abstract class SENE_Model
{
    // properties
    public $db;
    protected $directories;
    protected $config;
    public $field = array();

    //methods
    public function __construct();
    private function loadEngine(object $db = null);
    public function __encrypt(string $val): string;
    public function __decrypt(string $key): string;
}

Constructor

The sene_model::__construct() initializes the object by setting the directories and config variables to the global $SEMEDIR and $SEMECFG arrays, respectively. It then calls the loadEngine() method to load the database engine configuration.

  • Parameters: None
  • Returns: The SENE_Model instance itself ($this)

$db

The $db property is an instance of a database driver class, which is used to interact with the database. It is set by the loadEngine() method and can be accessed using the $this->db syntax. By default this will load the SEMECFG['DB']['ENGINE'] setting from the configuration file. For now, the only supported engine is MySQLi (sene_mysqli_engine class).