Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a one-to-one related record in a separate table during processing (save()) of a form?
    primarykey
    data
    text
    <p>Here's the schema:</p> <pre><code>sf_guard_user columns: id { type: integer, primary: true, notnull: true, autoincrement: true, unique: true } username { type: string } firstname { type: string } lastname { type: string } password { type: string } salt, algorith, etc... sf_guard_user_profile columns: id { type: integer, primary: true, notnull: true, autoincrement: true, unique: true } user_id { type: integer } user_type { type: integer } relations: User: { class: sfGuardUser, local: user_id, foreign: id, type: one, foreignType: one, foreignAlias: Profile } Type: { local: type_id, foreign </code></pre> <p>Here's what I'm trying to do in the frontend: I'm trying to allow the frontend user to create new user's... which I can do and all goes well. </p> <p>Where I'm stuck: (1) during the save() process of creating the sf_guard_user, creating the new user's sf_guard_user_profile and setting the column value of 'user_id' to the primary key of the newly-created sf_guard_user (column 'id'). (2) Then also setting the column 'user_type' to 4.</p> <p>I don't even know where to begin. If someone could point me in the right direction, I'd be would be greatly appreciated.</p> <p>UPDATE:</p> <p>This is my actions.class.php file (project/Source Files/apps/modules/users/actions):</p> <pre><code>protected function processForm(sfWebRequest $request, sfForm $form) { $form-&gt;bind($request-&gt;getParameter($form-&gt;getName()), $request-&gt;getFiles($form-&gt;getName())); if ($form-&gt;isValid()) { $sf_guard_user = $form-&gt;save(); $this-&gt;redirect('users/edit?id='.$sf_guard_user-&gt;getId()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload