The code:
class Robots extends \Phalcon\Mvc\Model
{
public function getSource()
{
return "dogs";
}
}
$robot = Robots::findFirst(3);
The sqlStatement trac is:
SELECT dogs
.id
, dogs
.name
, dogs
.age
, dogs
.created_at
, dogs
.updated_at
FROM dogs
WHERE dogs
.id
= 3 LIMIT 1
I want the sqlStatement can be like this:
SELECT dogs
.id
, dogs
.name
, dogs
.age
, dogs
.created_at
, dogs
.updated_at
FROM database
.dogs
WHERE dogs
.id
= 3 LIMIT 1
Just like the sqlStatement I want FROM dogs can be like FROM database.dogs
The model class can set the table name with the function getSource(), how can i set the database attribute with something when i want to use the same connection but the different database.