We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Populate form with array, how?

Hi,

in my controller I have an array and I want pass this array to my form to populate it: `php $user = array( 'name' => 'John', 'phone' => '555', ); $userForm = new \Application\Forms\User($user); `

This gives back an error, even if I convert the $user to an object with (object).

How can I populate my form with the array?

Ok, my bad, it works if I convert it to object, there was a $this->setEntity() in the form which overwrote it.

$form->bind($_POST, null);