0

the controller

class User extends MX_Controller{
    function __construct() {
        parent::__construct();
    }
    function index(){
         $r=R::dispense('group');
         $r->GroupName="hh";
         $i=R::store($r);
         echo $i;
         $r->hello();
    }
}

the model

class Model_Group extends RedBean_SimpleModel{
    function __construct() {
        parent::__construct;
    }
    function open(){
        echo "model";
    }
    function update(){
        echo "update";
    }
    function hello() {
        echo "hello";
    }
}

the output it just returns the id neither the hook functions (open -update - etc........)nor the custom functions (hello) as mentioned from the redbean docs

so i am asking what's wrong or what i should do to work properly

  • Are you using the latest version of Redbean? Are you sure the Model_Group class is being included on a page? I use Redbean and have this working with several of the tables. – Tim Withers Apr 12 '12 at 14:41
  • ok my friend i used the one by rubensarrio at GitHub and it is the last 3 but still magic functions doesn't work at alleven if loading the model the magic functions doesn't work but it stores the value to the database and prints out the id – Mohammed Gomma Apr 13 '12 at 20:24
  • thanks a lot it worked \application\libraries\RB\drivers\ModelFormatter.php in the function formatModel replace the return with return 'Model_'.$model; and load the model through the controller: $this->load->model('Model_item'); – Mohammed Gomma Apr 14 '12 at 10:28

1 Answers1

1

According to your code, I think you should load a model to fix this problem.

For example:

 $this->load->model("module_name/model_name")
David Cain
  • 16,484
  • 14
  • 65
  • 75