PHP Class ManaPHP\Mvc\Model\Manager

Inheritance: extends ManaPHP\Component, implements ManaPHP\Mvc\Model\ManagerInterface
Show file Open project: manaphp/manaphp

Protected Properties

Property Type Description
$_builder ManaPHP\Mvc\Model\QueryBuilderInterface
$_readConnectionServices array
$_recallGetModelSource boolean
$_sources array
$_writeConnectionServices array

Public Methods

Method Description
createBuilder ( string | array $params = null ) : ManaPHP\Mvc\Model\QueryBuilderInterface Creates a \ManaPHP\Mvc\Model\Query\Builder
getLastQuery ( ) : string Returns the latest query created or executed in the models manager
getModelSource ( ManaPHP\Mvc\ModelInterface | string $model ) : string Returns the mapped source for a model
getReadConnection ( ManaPHP\Mvc\ModelInterface | string $model ) : ManaPHP\DbInterface Returns the connection to read data related to a model
getReadConnectionService ( ManaPHP\Mvc\ModelInterface | string $model ) : string Returns the connection service name used to read data related to a model
getWriteConnection ( ManaPHP\Mvc\ModelInterface | string $model ) : ManaPHP\DbInterface Returns the connection to write data related to a model
getWriteConnectionService ( ManaPHP\Mvc\ModelInterface | string $model ) : string Returns the connection service name used to write data related to a model
setConnectionService ( ManaPHP\Mvc\ModelInterface | string $model, string $connectionService ) : static Sets both write and read connection service for a model
setModelSource ( ManaPHP\Mvc\ModelInterface | string $model, string $source ) : static Sets the mapped source for a model
setReadConnectionService ( ManaPHP\Mvc\ModelInterface | string $model, string $connectionService ) : static Sets read connection service for a model
setWriteConnectionService ( ManaPHP\Mvc\ModelInterface | string $model, string $connectionService ) : static Sets write connection service for a model

Method Details

createBuilder() public method

Creates a \ManaPHP\Mvc\Model\Query\Builder
public createBuilder ( string | array $params = null ) : ManaPHP\Mvc\Model\QueryBuilderInterface
$params string | array
return ManaPHP\Mvc\Model\QueryBuilderInterface

getLastQuery() public method

Returns the latest query created or executed in the models manager
public getLastQuery ( ) : string
return string

getModelSource() public method

Returns the mapped source for a model
public getModelSource ( ManaPHP\Mvc\ModelInterface | string $model ) : string
$model ManaPHP\Mvc\ModelInterface | string
return string

getReadConnection() public method

Returns the connection to read data related to a model
public getReadConnection ( ManaPHP\Mvc\ModelInterface | string $model ) : ManaPHP\DbInterface
$model ManaPHP\Mvc\ModelInterface | string
return ManaPHP\DbInterface

getReadConnectionService() public method

Returns the connection service name used to read data related to a model
public getReadConnectionService ( ManaPHP\Mvc\ModelInterface | string $model ) : string
$model ManaPHP\Mvc\ModelInterface | string
return string

getWriteConnection() public method

Returns the connection to write data related to a model
public getWriteConnection ( ManaPHP\Mvc\ModelInterface | string $model ) : ManaPHP\DbInterface
$model ManaPHP\Mvc\ModelInterface | string
return ManaPHP\DbInterface

getWriteConnectionService() public method

Returns the connection service name used to write data related to a model
public getWriteConnectionService ( ManaPHP\Mvc\ModelInterface | string $model ) : string
$model ManaPHP\Mvc\ModelInterface | string
return string

setConnectionService() public method

Sets both write and read connection service for a model
public setConnectionService ( ManaPHP\Mvc\ModelInterface | string $model, string $connectionService ) : static
$model ManaPHP\Mvc\ModelInterface | string
$connectionService string
return static

setModelSource() public method

Sets the mapped source for a model
public setModelSource ( ManaPHP\Mvc\ModelInterface | string $model, string $source ) : static
$model ManaPHP\Mvc\ModelInterface | string
$source string
return static

setReadConnectionService() public method

Sets read connection service for a model
public setReadConnectionService ( ManaPHP\Mvc\ModelInterface | string $model, string $connectionService ) : static
$model ManaPHP\Mvc\ModelInterface | string
$connectionService string
return static

setWriteConnectionService() public method

Sets write connection service for a model
public setWriteConnectionService ( ManaPHP\Mvc\ModelInterface | string $model, string $connectionService ) : static
$model ManaPHP\Mvc\ModelInterface | string
$connectionService string
return static

Property Details

$_builder protected property

protected QueryBuilderInterface,ManaPHP\Mvc\Model $_builder
return ManaPHP\Mvc\Model\QueryBuilderInterface

$_readConnectionServices protected property

protected array $_readConnectionServices
return array

$_recallGetModelSource protected property

protected bool $_recallGetModelSource
return boolean

$_sources protected property

protected array $_sources
return array

$_writeConnectionServices protected property

protected array $_writeConnectionServices
return array