Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3610762
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:47:32+00:00 2026-05-18T21:47:32+00:00

I have a form for an object called AccountImport . This form lives in

  • 0

I have a form for an object called AccountImport. This form lives in an admin-generated module. In addition to the fields that map directly to this object’s attributes, I need a couple extra fields.

If I just add the fields to the AccountImport form, it won’t save correctly because the form will no longer match the AccountImport object.

If I create a template manually and splice the extra fields in that way, I’m throwing away all the stuff the admin generator gives me for free (i.e. formatting, “Back to list” button, save buttons).

What’s a “good” way to do what I’m trying to do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:47:33+00:00Added an answer on May 18, 2026 at 9:47 pm

    If you define additional fields in generator.yml, you can override one of the admin generator actions to handle the fields however you want.

    Look at the generated actions.class.php in cache/YOURAPP/YOURENV/modules/autoYOURMODULE/actions/actions.class.php . You can override any of those functions with your own in apps/YOURAPP/modules/YOURMODULE/actions/actions.class.php, because it inherits from that cached file. When you make changes to generator.conf, the cached file is updated but your code will still override it. You probably want to override processForm().

    I have an example of this in step 5 at this blog post:

    protected function processForm(sfWebRequest $request, sfForm $form)
    {
      $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    
      if ($form->isValid())
      {
    $notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
    
    // NEW: deal with tags
    if ($form->getValue('remove_tags')) {
      foreach (preg_split('/\s*,\s*/', $form->getValue('remove_tags')) as $tag) {
        $form->getObject()->removeTag($tag);
      }
    }
    if ($form->getValue('new_tags')) {
      foreach (preg_split('/\s*,\s*/', $form->getValue('new_tags')) as $tag) {
        // sorry, it would be better to not hard-code this string
        if ($tag == 'Add tags with commas') continue;
        $form->getObject()->addTag($tag);
      }
    }
    
    try {
      $complaint = $form->save();
      // and the remainder is just pasted from the generated actions file
    

    When I realized I could read the generated files in the cache to see exactly what the admin generator was doing, and that I could override any part of them, it made me a lot more productive with the admin generator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view that is bound to an object called Requisition On this
If I have a form-backing object that has a complicated object tree -- say
If I have .Net Form with a component/object such as a textbox that I
I have a basic form with controls that are databound to an object implementing
In the following scenario, you have a business object called Employee that contains all
I have an object called Person that has the following properties: int id; Name
I have a main thread that creates a form object which creates and sets
I'm modeling my app in Core Data. I have an object called 'stats' that
My form receives asynchronous callbacks from another object on random worker threads. I have
I have form that displays several keywords (standard set of choice lists that changes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.