Additionally to this; I have tried using the doUpdateObject() method;
I figure I can put the update code in there. However, the method isn't
getting called.

In my /lib/form/doctrine/businessForm.class.php, as a method of the
businessForm class, I have:

  protected function doUpateObject($values) {
    echo 'why doesnt this work?';
    exit('in doUpateObject');
    parent::doUpdateObject($values);
  }

However when I use the backend admin generator, and save a business;
this method doesn't get called -- the exit() doesn't get triggered.

What am I missing here?

thanks



On Jun 24, 11:33 am, bretth <brett...@gmail.com> wrote:
> Hi all,
>
> i've got a question regarding where to put the code that actually
> saves the values in an embedded form.
>
> My scenario: I have a business object and a business_category object
> as well as a business_business_category object which ties
> business_categories to a business in a many to many relationship.
>
> I have created a custom form (businessCategoriesSelectionForm) which
> basically does:
>
> --------------------------------------------------
>
>   $categories = Doctrine::getTable('business_category')->findAll();
>
>   foreach ($categories as $category) {
>     $this->setWidget($category->getSlug(), new
> sfWidgetFormInputCheckbox());
>     $this->setValidator($category->getSlug(), new
> sfValidatorBoolean());
>   }
>
> --------------------------------------------------
>
> to build a list of checkboxes. In the businessForm I then embed this
> form:
>
> --------------------------------------------------
>
>   // Embed the categories form
>   $businessCategoriesSelectionForm = new
> businessCategoriesSelectionForm();
>   $this->embedForm('businessCategoriesSelectionForm',
> $businessCategoriesSelectionForm);
>
> --------------------------------------------------
>
> Everything is good so far; when I am using the admin-generator
> backend, I then see the custom form I build appear; with the
> checkboxes appearing as they should etc.
>
> So now, my question is: where do I write the code which will delete/
> create business_business_category objects to ensure that the business
> is linked to which ever categories have been selected in the
> checkboxes?
>
> I am used to doing it in the controller, whenever these kinds of
> things are done via the front end (ie not using the admin-generator
> system). Is this the best way to be doing it?
>
> If so, where does this sort of code go? What method would I use in /
> apps/backend/modules/business/actions/actions.class.php? Some sort of
> preFoo() method?
>
> I've gotten the impression from the docs that this sort of thing
> should actually be done on the form itself; using the updateObject()
> method or something. Is that the best place for it? And if so, would I
> put it on the businessForm updateObject() or the
> businessCategoriesSelectionForm form?
>
> In the past, it's always seemed better to put this kind of stuff in
> the controller itself, instead of the form; because to me the form is
> more about setting up and validating form's, not so much about
> actually updating the database (via the Model layer of course).
>
> Am I way off track here?
>
> And where should that update code go?
>
> thanks a lot!
>
> Brett

-- 
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

Reply via email to