0

This is my code.

$param = array('email');

$this->getMapper()->copyfrom('POST',function($val) {

    return array_intersect_key($val, array_flip($param));

});

And I get the error in title array_flip() expects parameter 1 to be array, null given issue

If I put directly

return array_intersect_key($val, array_flip(array('email')));

it works.

[Framework is F3, v. 3.5.0].

THank you

sineverba
  • 5,059
  • 7
  • 39
  • 84

1 Answers1

4

I think maybe it will work.

$param = array('email');

$this->getMapper()->copyfrom('POST',function($val) use ($param) {

    return array_intersect_key($val, array_flip($param));

});
Volkan Yılmaz
  • 539
  • 3
  • 10