Closed nCrazed closed 10 years ago
Hey thanks for the suggestion. Would just casting the array to an object be enough or do you need to use keys that wouldn't be valid as property names (like keys with hyphens, or starting with numbers, etc.)?
If that will work, could just modify bind
to look like this:
public function bind($model)
{
$this->model = is_array($model) ? (object) $model : $model;
}
Yeah, that should be sufficient, thanks.
Cool, still feel free to submit that as a PR if you like (with tests of course! :smile: ) and I'll merge it in, or I'll add it in when I get a chance.
It would be very convenient if the
FormBuilder::bind
worked with array as well as objects just like Larave'sForm::model
.Let me know if that's a feature you want to include in this library and I'll start working on a PR.