Hello!

I am trying to embed an user profile in a company form. My question is
where can I save the relation between the UserProfile and the Client
(this is stored in an extra table). Also my UserProfile form does not
save (I think it has something to do with the fact that the embedded
form is not saving as sfGuardUserProfile, but as BdnClientContactForm.
How can I debug this?

//BdnClientForm.class.php
    public function addClientContact($num) {
        $client_contact = new sfGuardUserProfile();
        $client_contact_form = new
sfGuardUserProfileForm($client_contact);
        $this->embeddedForms['client_contacts']->embedForm($num,
$client_contact_form);
        $this->embedForm('client_contacts', $this-
>embeddedForms['client_contacts']);
    }

    public function addClientContactForm($key) {
        $client_contacts = new sfGuardUserProfile();
        $this->embeddedForms['client_contacts']->embedForm($key, new
sfGuardUserProfileForm($client_contacts));
        $this->embedForm('client_contacts', $this-
>embeddedForms['client_contacts']);
    }

    public function bind(array $taintedValues = null, array
$taintedFiles = null) {
        if(isset($taintedValues['client_contacts']))
            foreach($taintedValues['client_contacts'] as $key=>$form)
{
                if (false === $this->embeddedForms['client_contacts']-
>offsetExists($key)) {
                    $this->addClientContactForm($key);
                }
            }
        parent::bind($taintedValues, $taintedFiles);
    }

    public function configure() {
        $client_contacts_forms = new sfForm();
        $this->embedForm('client_contacts', $client_contacts_forms);
        $this->widgetSchema['client_contacts']->setLabel('Contact
persons ');
..}


//actions.class.php
   public function executeAddClientContactForm(sfWebRequest $request)
{
        $this->forward404Unless($request->isXmlHttpRequest());
        if ($client = BdnClientPeer::retrieveByPk($request-
>getParameter('id'))) {
            $form = new BdnClientForm($client);
        }
        else {
            $form = new BdnClientForm();
        }
        $number = $request->getParameter('num')+1;
        $key = 'client_contact'.$number;
        $form->addClientContactForm($key);
        return $this-
>renderPartial('addClientContactForm',array('field' =>
$form['client_contacts'][$key], 'num' => $number));
    }

Thank you!

Mihai Rusoaie
+40 72 RUSOAIE
www.rusoaie.com

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to