Reputation: 33644
I have the following code:
public function postFormAction(Request $request)
{
$cityId = $request->request->get('shopiousUserBundle_user')['location']['city'];
.....
}
for some reason this is giving me a syntax error, any idea why? When I remove the array indexing to be just like:
$cityId = $request->request->get('shopiousUserBundle_user')
works fine.
Upvotes: 0
Views: 73
Reputation: 164766
Array dereferencing from the result of a function call is only available in PHP 5.4 or later.
See http://php.net/manual/en/language.types.array.php#example-88
If you are using an earlier PHP version, you will have to do the following
$data = $request->request->get('shopiousUserBundle_user');
$cityId = $data['location']['city'];
Upvotes: 4