class Robots extends Phalcon\Mvc\Model
{
public function selectReadConnection($intermediate, $bindParams, $bindTypes)
{
....
params ($intermediate, $bindParams, $bindTypes) is fixed or custom?
how to set the param value?
|
|
Apr '13 |
3 |
1130 |
1 |
class Robots extends Phalcon\Mvc\Model
{
public function selectReadConnection($intermediate, $bindParams, $bindTypes)
{
....
params ($intermediate, $bindParams, $bindTypes) is fixed or custom?
how to set the param value?
Follow tutorial https://docs.phalcon.io/en/latest/reference/models.html
But constants are wrong in documentation, correct are BIND_PARAM_NULL BIND_PARAM_INT BIND_PARAM_STR BIND_PARAM_BOOL BIND_PARAM_DECIMAL BIND_SKIP Related to : https://docs.phalcon.io/en/latest/api/Phalcon_Db_Column.html
now, the selectReadConnection is fixed method within phalcon framework, i want to say , selectReadConnection method not full intro in document , and i find the api \Phalcon\Mvc\Model not have this method .
but have these method in api
public Phalcon\Mvc\Model setReadConnectionService (string $connectionService)
Sets the DependencyInjection connection service name used to read data
public Phalcon\Mvc\Model setWriteConnectionService (string $connectionService)
Sets the DependencyInjection connection service name used to write data
public string getReadConnectionService ()
Returns the DependencyInjection connection service name used to read data related the model
public string getWriteConnectionService ()
Array
(
[models] => Array
(
[0] => Test
)
[tables] => Array
(
[0] => test
)
[columns] => Array
(
[test] => Array
(
[type] => object
[model] => Test
[column] => test
[balias] => test
)
)
[where] => Array
(
[type] => binary-op
[op] => =
[left] => Array
(
[type] => qualified
[domain] => test
[name] => id
[balias] => id
)
[right] => Array
(
[type] => literal
[value] => 1
)
)
)
parame $intermediate 's print_r value.
this post not a question , Facilitate others to use
selectReadConnection is not implemented by the extension, the extension checks if the method has been defined by the developer in a model and calls it, this is the same behavior for event callbacks (beforeSave, beforeDelete) etc.
Actually, this funcionality is not intended to implement vertical sharding, you can use this method to implement horizontal sharding, this means, return a connection name according to the current search parameters, rather than return a table name.