addClassMap() публичный статический Метод

Add information about model's classes
public static addClassMap ( string $model, string $className ) : void
$model string
$className string
Результат void
Пример #1
0
 /**
  * Create and initialize Table instance
  */
 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();
 }