Documentation Framecore

Documentation on working with FrameCore. Setting up and using classes. Development of applications based on this platform

ModelsManager

The component manages the initialization of models in the application


Initialization in system. A ModelsManager is injected to a models

$this->modelsManager = new ModelsManager;

Exist Methods

_createBuilder()
_columns(string)
_from(array)
_leftjoin(class model, string, string)
_rightjoin(class model, string, string)
_innerjoin(class model, string, string)
_where(string, array)
_orderBy(string)
_groupBy(string)
_limit(string)
_insert(class model, array)
_update(class model, array)
_delete(class model)
_getSql()
_getRow()
_getSingleQuery()
_groupBy(string)
_getLastInsertId()
_setStatementArray()
_beginTransaction()
_getErrors()
_toArray()
_count()
->execute()

A simple example of using the model manager. You can manipulate methods according to your needs.

return (new ModelsManager)->createBuilder()
  ->columns('c.id AS id, c.brand AS brand, m.name AS model')
  ->from(['c' => 'Models\Cars']) 
  ->leftjoin('Models\CarModels', 'c.model_id=m.id', 'm')
  ->where('c.is_active = :active', [':active'=>1])
  ->orderBy('c.name DESC')
  ->groupBy('c.brand_id')
  ->limit('0,100')
  ->getQuery()
  ->execute();










Return Back