CakePHP not inserting into model -


my model:

class buyitpackage extends appmodel {      var $name = 'buyitpackage';      var $belongsto = array('user', 'auction');      function __construct($id = false, $table = null, $ds = null){         parent::__construct($id, $table, $ds);     }  } 

my save action:

function add($user_id = null, $auction_id = null) {     $this->buyitpackage->create(); // line 23      $data = array (             'buyitpackage' => array(                 'user_id' => $user_id,                 'auction_id' => $auction_id,                 'name' => '',                 'price' => 0.00,                 'contract' => '',                 'points' => 0             )         );     $this->buyitpackage->save($data); } 

when navigate add() action error generated

undefined property: buyitpackagescontroller::$buyitpackage [app/controllers/buy_it_packages_controller.php, line 23] 

no data inserted, looks cannot find model, ideas?

set data in array , save save method.

$this->data["buyitpackage"]['user_id'] = $user_id; $this->data["buyitpackage"]['auction_id'] = $auction_id; $this->data["buyitpackage"]['name'] = 'dummyvalue1'; $this->data["buyitpackage"]['price'] = '0.00'; $this->data["buyitpackage"]['contract'] = 'dummyvalue2'; $this->data["buyitpackage"]['points'] = '0';  $this->buyitpackage->save($this->data["buyitpackage"], false); 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -