techie_28
techie_28

Reputation: 2133

Undefined property: ::$save

I have been setting up a controller to save my data.

...
if ($this->Fee->save{$data}) {
...

But i am getting this error

undefined property: Fee::$save

Full code as follows:

App::import('Model','Fee');
    $this->Fee = new Fee();
    $fee = $this->Fee->find('first',array('fields'=>array('Fee.amount','Fee.id')));
    $this->set('fee',$fee);
    if(!empty($this->data)){
      $this->Fee->set($this->data);
      if($this->Fee->validates()){
        $data           = array();
        $data['id']     = $fee['Fee']['id'];
        $data['amount'] = $this->data['Fee']['amount'];
        $this->Fee->set($data);        
        if($this->Fee->save{$data}){
          $this->Session->setFlash('<div class="success">'.__('AMOUNT_SAVED_SUCCESSFULLY',true).'</div>');
        }else{
        }
      }else{
        $this->set('errors',true);
      }
    }

I am using this in admins controllers admin_fee action. I am importing the model fee there. My model file is fee.php and name is Fee.

Upvotes: 0

Views: 175

Answers (1)

Galen
Galen

Reputation: 30170

maybe

$this->Fee->save($data)

Parenthesis instead of curly brackets

Upvotes: 1

Related Questions