0

This code is using a table Users to update a field myField. Now I have a need to use a table called Customer and update a field called customerRelation to 1. How would I do that?

var $name = 'Answers';

    var $components = array('RequestHandler');

    var $uses = array('Answer','Field','User');


    function checkAll() {

        $user = $this->User->read(null,$this->Auth->user('uid'));
        $this->User->saveField('myField', 'TEST');

    }
MrTux
  • 32,350
  • 30
  • 109
  • 146
Asim Zaidi
  • 27,016
  • 49
  • 132
  • 221

2 Answers2

2

LINK The methods are the same to load a model in the controller. I hope you use a model for the needed table.

Community
  • 1
  • 1
Mika
  • 1,539
  • 15
  • 22
2
ar $name = 'Answers';

var $components = array('RequestHandler');

var $uses = array('Answer','Field','User','Customer');


function checkAll() {

    $user = $this->User->read(null,$this->Auth->user('uid'));
    $this->User->saveField('myField', 'TEST');
    $this->Customer->saveField('customerRelation ', 1);

}
chetanspeed511987
  • 1,995
  • 2
  • 22
  • 34