Bluz\Db\Table::__construct PHP Method

__construct() private method

Create and initialize Table instance
private __construct ( )
    private function __construct()
    {
        $tableClass = static::class;
        // autodetect model name
        if (!$this->model) {
            $model = substr($tableClass, strpos($tableClass, '\\') + 1);
            $model = substr($model, 0, strpos($model, '\\', 2));
            $this->model = $model;
        }
        // autodetect table name - camelCase to uppercase
        if (!$this->table) {
            $table = preg_replace('/(?<=\\w)(?=[A-Z])/', "_\$1", $this->model);
            $this->table = strtolower($table);
        }
        // autodetect row class
        if (!$this->rowClass) {
            $rowClass = substr($tableClass, 0, strrpos($tableClass, '\\', 1) + 1);
            $this->rowClass = $rowClass . 'Row';
        }
        // setup default select query
        if (empty($this->select)) {
            $this->select = "SELECT * " . "FROM " . DbProxy::quoteIdentifier($this->table);
        }
        Relations::addClassMap($this->model, $tableClass);
        $this->init();
    }