i am using codeigniter latestversion and i have installed phpactiverecord version 0.0.2,
however when i retrieved data from database with this method
$users = Users::find('all') // return nothing
i did var_dump($users);
output::
array (size=2)
0 =>
object(Users)[39]
public 'errors' => null
private 'attributes' (ActiveRecord\Model) =>
array (size=9)
'id' => null
'username' => null
'email' => null
'password' => null
'active' => int 0
'activation' => null
'ip' => null
'created' => null
'lastaccess' => null
private '__dirty' (ActiveRecord\Model) => null
private '__readonly' (ActiveRecord\Model) => boolean false
private '__relationships' (ActiveRecord\Model) =>
array (size=0)
empty
private '__new_record' (ActiveRecord\Model) => boolean true
1 =>
object(Users)[40]
public 'errors' => null
private 'attributes' (ActiveRecord\Model) =>
array (size=9)
'id' => null
'username' => null
'email' => null
'password' => null
'active' => int 0
'activation' => null
'ip' => null
'created' => null
'lastaccess' => null
private '__dirty' (ActiveRecord\Model) => null
private '__readonly' (ActiveRecord\Model) => boolean false
private '__relationships' (ActiveRecord\Model) =>
array (size=0)
empty
private '__new_record' (ActiveRecord\Model) => boolean true
i am trying to figure out what is the problem ,,, any help please
///// Model
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Users extends ActiveRecord\Model {
public function __construct() {
parent::__construct();
}
}
/* End of file user.php */
/* Location: ./application/models/user.php */
?>
///// Controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User extends MY_Controller {
public function __construct() {
parent::__construct();
}
public function index()
{
$user = Users::all();
var_dump($user);
foreach ($user as $u) {
echo $u->username.'<br/>';
}
## Rendering the view
$this->template->view($this->temp, array('page'=>'backend/users'), NULL);
}
}
/* End of file users.php */
/* Location: ./application/controllers/users.php */
?>
////// Autoload
$autoload['sparks'] = array('php-activerecord/0.0.2');
Remove the
__construct()
function entirely from theUsers
model