[eluser]ThiagoPHX[/eluser]
Hey, i'm trying to use a model inside another model without success.
I'm doing like this
The structure of my model folder is the follow
/model
/vo
/UserVO.php
/dao
/UserDAO.php
In the controller i call the UserDAO.php, and UserDAO receives a UserVO object to execute the functions, or in a function that list the user in the database, the UserDAO sends to controller an array of UserVO object.
The UserDAO
Code:
class UserDAO extends Model
{
const TABLE = 'users';
public function __construct()
{
parent::Model();
}
public function listUsers($limit, $offset)
{
$this->load->model('vo/UserVO', 'UserVO');
$result = $this->db->get(self::TABLE, $limit, $offset);
$users = array();
foreach ($result->result() as $row) {
$user = $this->UserVO;
$user->setId($row->user_id);
$user->setNome($row->user_nome);
$user->setSenha($row->user_senha);
$users[] = $user;
}
return $users;
}
}
Thanks