sfMelodyPlugin
sfMelodyPlugin copied to clipboard
sfMelodyPlugin and sfGuardUserProfile
Look at this http://forum.symfony-project.org/viewtopic.php?f=12&t=33956 I have same trouble. In propel version of sfGuardPlugin, there aren't such fields as first_name or email_adress. Normally i use sf_guard_user_profile table for such data:
App.yml:
all: sf_guard_plugin: profile_class: sfGuardUserProfile profile_field_name: sf_guard_user_id
But sfMelodyPlugin not work with the profile, plugin try to use setters of sfGuardUser object only. There is some patch of that problem. Some key in app.yml explains to sfMelody to look for profile setters if it cant't find in sfGuardUser.
For example, my app.yml.
all: sf_guard_plugin: profile_class: sfGuardUserProfile profile_field_name: sf_guard_user_id melody: use_profile: true ..... first_name: call: me path: first_name last_name: call: me path: last_name nick: call: me path: username ext_id: call: me path: id ext_link: call: me path: link
After registration i get 2 new tuples in DB:
select * from sf_guard_user; id | username | algorithm | created_at | last_login | is_active | is_super_admin | email ----+---------------------+-----------+---------------------+---------------------+-----------+----------------+------------------- 19 | Facebook_1464279882 | sha1 | 2012-02-08 13:15:14 | 2012-02-08 13:15:14 | t | f | [email protected] (1 row) select * from sf_guard_user_profile; sf_guard_user_id | first_name | last_name | nick | ext_id | ext_link ------------------+------------+-----------+---------+------------+--------------------------------- 19 | Maksim | Ustinov | madesst | 1464279882 | http://www.facebook.com/madesst (1 row)
Code is very stupid, but it works for now. I hope this will be useful.
I've commited improvments in sfMelodyUserFactory, BasesfMelodyActions for working with register_redirect: true.
Do you need any comments about this pull request?
Hi,
At the beginning, I wanted to add the possibility the specify a path linked to the user class in the config and never done it. I think your solution can be usefull for propel guy so we can merge as a first shot.
And then when me or someone else change the process we can merge the next version... :p