Reputation: 5395
In CakePHP 3 I can access a POST variable such as start
like this:
$this->request->getData('start')
If my POST value is in the form of an array - in plain PHP such as $_POST['order'][3]['column']
I can access it in Cake like this:
$this->request['data']['order'][3]['column']
Is this the correct (or only) way to do this, or should you also be able to use getData()
to access it?
Upvotes: 0
Views: 5428
Reputation: 25698
Use the OO way to access things. There are reasons why the interfaces exists to access data through them. See getData().
// As array
$this->request->getData('order')[3]['column'];
// https://api.cakephp.org/3.4/class-Cake.Utility.Hash.html#_get
$this->request->getData('order.3.column');
Upvotes: 3