Thanks for the "foreignAlias: Profile" advice On 25 nov, 15:18, axel at <[email protected]> wrote: > the problem was my doctrine database yml > > with the following definition it works for doctrine: > > sfGuardUserProfile: > columns: > id: { type: integer, primary: true, autoincrement: true } > user_id: { type: integer(4) } > firstname: { type: string(255) } > lastname: { type: string(255) } > phone: { type: string(255) } > address: { type: string(255) } > .... > relations: > User: > class: sfGuardUser > local: user_id > foreign: id > type: one > foreignType: one > foreignAlias: Profile > options: > collate: utf8_unicode_ci > charset: utf8 > > On 25 Nov., 11:49, tirengarfio <[email protected]> wrote: > > > After following the README at sfDoctrineGuardPlugin doc, this is > > working for me: > > > In the actions: > > > $this->getUser()->getGuardUser()->getId() > > $this->getUser()->getGuardUser()->getUsername() > > $this->getUser()->getGuardUser()->getProfile()->getAddress() > > > In the templates: > > > $sf_user->getGuardUser()->getId() > > $sf_user->getGuardUser()->getUsername() > > $sf_user->getGuardUser()->getId()->getProfile()->getAddress() > > > Javi > > > On Nov 24, 11:43 pm, larry <[email protected]> wrote: > > > > I just had a similar issue. In my case, I had copied info from the > > > schema.yml file that comes with the sfGuardUserPlugin to the top-level > > > config/schema.yml file in my project. That was pretty stupid on my > > > part. When I ran propel:build-model, Symfony generated some generic > > > model classes with names like sfGuardUserPeer. These overrode all of > > > the classes in the plugin, so I suddenly lost all of the functionality > > > in the plugins. I needed to pull the sfGuardUser data out of my top- > > > level schema.yml file, delete the generic models that just happened to > > > have names like sfGuardUserPeer, and thus allow my site to "see" the > > > code in the plugin. > > > > If I were you, I'd look for some place where you may have some code > > > that is overriding the defaults in the plugin. > > > > On Nov 24, 9:55 am, axel at <[email protected]> wrote: > > > > > Hello, > > > > > I try to customize the sfGuardUser model, therefore I added > > > > sfGuardUserProfile to my schema.yml and built/executed model and sql > > > > for it. > > > > > here's the problem: > > > > $this->getUser()->getProfile()->getFirstName(); throws the following > > > > error: > > > > Unknown method sfGuardUser::getProfile > > > > > my configuration: > > > > > schema.yml > > > > ... > > > > sfGuardUserProfile: > > > > connection: xyz > > > > columns: > > > > id: > > > > type: integer(4) > > > > primary: true > > > > autoincrement: true > > > > userid: > > > > type: integer(4) > > > > first_name: varchar(20) > > > > last_name: varchar(20) > > > > birthday: date > > > > relations: > > > > sfGuardUser: > > > > foreignAlias: sfGuardUserProfile > > > > local: userid > > > > foreign: id > > > > foreignType: one > > > > > myUser extends: > > > > class myUser extends sfGuardSecurityUser { > > > > > } > > > > > echo get_class($this->getUser()); > > > > > >> myUser > > > > > echo get_parent_class($this->getUser()); > > > > > >> sfGuardSecurityUser > > > > > I also added > > > > sf_guard_plugin: > > > > profile_class: sfGuardUserProfile > > > > profile_field_name: user_id > > > > to my app.yml > > > > > any ideas? > > > > thx a lot > >
-- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.
