Hi guys, I want to set value for a field in Form by this code:
$city = new Text('city');
$city->setDefault($userModel->City->title);
$city->setLabel('City');
$city->addValidators([ new PresenceOf() ]);
$this->add($city);
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 ?
thanks.