How to disable the auto instantiate in Models or libraries

[eluser]Diego Pessoa[/eluser]
Hi, I have a problem:

class Foo extends Model {
public $bar;

public function __construct($bar) {
$this->bar = $bar;


A simple classs right?

Let's to load this:


The result:
Message: Missing argument 1 for Foo.

How I can do to disable this auto-instantiate?

Not possible in CI, try a default value for the variable in the constructor

public function __construct($bar = NULL) {
    $this->bar = $bar;

Although, load_class('class_name', FALSE) is available, I haven't tried using this with Models.

[eluser]Diego Pessoa[/eluser]
Hummm, the load_class function solves the problem with libraries, but it not works with Models. =\

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.