Use relationship data to setDefault in Form

Hi guys, I want to set value for a field in Form by this code:

$city = new Text('city');



$city->addValidators([ new PresenceOf() ]);


but I got this error:

Catchable fatal error: Object of class app\common\models\City could not be converted to string in E:\xampp\htdocs\phalcon\app\modules\frontend\views\user\profile.phtml on line 107

How can I set data from relationship ?


Are you passing or binding a entity model when creating the form instance? remove it and pass an stdClass docs

Good luck