webtechnick / CakePHP-Facebook-Plugin

CakePHP Facebook Plugin
http://facebook.webtechnick.com
445 stars 138 forks source link

Associated Models not being returned #116

Open starchildno1 opened 11 years ago

starchildno1 commented 11 years ago

Fail when trying to access data in associated models..

I tried setting Contain in Connect Component __syncFacebookUser //Login user if we have one $Auth->authenticate No go.

Inside of the __initUserModel I tried setting recursive = 1 still No go. Why is recursive set to not retrieve associated models anyway? Shouldn't that be left up to us?

starchildno1 commented 11 years ago

Well I retrieved the User's Associated Model by asking for it in the afterFaceBookLogin and appending it to the Auth Session.

If there is a more efficient way of doing this please tell..

public function afterFacebookLogin(){ $user_assc['Model']['field'] = ClassRegistry::init('Model')->field('field_name', array($this->Auth->user('assc_id'))); $this->Session->write('Auth.User', array_merge($this->Auth->user(), $user_assc)); }