在我的数据库中,我有以下表格:“clients”、“userProfile”和“sfGuardUsers”
我希望系统在创建新客户端时创建配置文件和用户。这是我到目前为止所拥有的:
在lib/form/doctrine/ClientForm.class.php:
class ClientForm extends BaseClientForm
{
public function configure()
{
parent::configure();
$userProfileForm = new UserProfileForm($this->object->UserProfile->user);
$this->mergeForm($userProfileForm);
}
}
在modules/client/action/actions.class.php:
class clientActions extends autoClientActions
{
public function executeCreate(sfWebRequest $request)
{
parent::executeCreate($request);
$this->client->createProfile($request->getParameter('email'),$request->getParameter('password'));
}
在lib/model/doctrine/Client.class.php:
public function createProfile($email, $password)
{
$profil = Doctrine_Core::getTable('UserProfile')->findOneByClientId($this->getId());
$profil->createUser($email, $password);
$profil->setClient($this);
$profil->save();
}
根据日志,createProfile(null, null)
被调用,mysql创建一个用户''
作为其用户名:(