CakePHP-Facebook-Plugin icon indicating copy to clipboard operation
CakePHP-Facebook-Plugin copied to clipboard

Associated Models not being returned

Open starchildno1 opened this issue 12 years ago • 1 comments

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 avatar Jan 30 '13 01:01 starchildno1

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)); }

starchildno1 avatar Feb 12 '13 15:02 starchildno1