vova07 / yii2-start

Yii2-Start application
Other
273 stars 115 forks source link

populateRelation doesn't work on SignUp Action #72

Closed cicoph closed 9 years ago

cicoph commented 9 years ago

Hi, on namespace vova07\users\controllers\frontend GuestController the signUp action did not save the Profile field on line 69: .... if ($user->load(Yii::$app->request->post()) && $profile->load(Yii::$app->request->post())) { if ($user->validate() && $profile->validate()) { $user->populateRelation('profile', $profile); // if ($user->save(false)) { ... When I try to edit my profile I have this error 22:01:33.561 info yii\db\Command::query SHOW CREATE TABLE stl_users 5 22:01:33.566 info yii\db\Command::query SELECT * FROM stl_users WHERE id=18 6 22:01:33.569 info yii\db\Command::query SELECT * FROM stl_profiles WHERE user_id=18 7 22:01:33.570 error yii\base\ErrorException:1 exception 'yii\base\ErrorException' with message 'Call to a member function load() on a non-object' in /Users/frank/Desktop/filestl/vendor/vova07/yii2-start-users-module/controllers/frontend/UserController.php:139

vova07 commented 9 years ago

I checked this case, but the I couldn't found the problem, all works fine. Is the issue appears on your own server or on demo site?

cicoph commented 9 years ago

Problem solved. I lost the data because on User.php model i have added: public $profile

Sorry and thank you

Francesco Loddo

Il giorno 20/set/2014, alle ore 00:27, Vasile C. notifications@github.com ha scritto:

I checked this case, but the I couldn't found the problem, all works fine. Is the issue appears on your own server or on demo site?

— Reply to this email directly or view it on GitHub.