Symfony Tip: Admin Generator + sfGuardPlugin + SfGuard Profile

If you get the error “Call to undefined method BasesfGuardUser::addsfGuardUserProfile” when using a custom sfGuardUser profile, you need to add the following method to the file /plugins/sfGuardPlugin/lib/model/sfGuardUser.php

  public function addsfGuardUserProfile()
  {
    if(!$profile = $this->getProfile())
    {
      $profile = new sfGuardUserProfile;
      $profile->setUserId($this->getId());
    }
    return $profile;
  }

I know it sucks to hack a core plugin file, but sometimes we must pragmatic!