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 334813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:05:24+00:00 2026-05-12T10:05:24+00:00

I am running Symfony 1.2 and utilizing the object helper to create some inline

  • 0

I am running Symfony 1.2 and utilizing the object helper to create some inline editable fields outside of a form. Because there is no symfony or scriptalicious short cut to create an inline edit tag for multiple choice select boxes (much like input_in_place_editor_tag or Ajax.InPlaceCollectionEditor), I am using object_select_tag with the multiple option set to true to create a select box like so:

<?php      
  echo object_select_tag($user->getsfGuardPermissions(), 'getId', array (
 'include_blank' => false,
 'related_class' => 'sfGuardPermission',
 'peer_method' => 'doSelect',
 'text_method' => '__toString',
 'control_name' => 'user_customer_permissions_'.$user_customer->getId(),
     'multiple' => true
));
?>

I will then call observe_field to update the object via Ajax when the form is changed. However

The problem is that while $user->getsfGuardPermissions() returns an array of sfGuardPermission objects. They are not selected by default.

After some testing, I found that if you pass it only one sfGuardPermission object instead of an array, the proper option is selected. Is this a limitation of Symfony or is there a different way of doing this? It’s hard to believe that symfony would include the ‘multiple’ option if they didn’t allow you to select multiple options by default.

Looking at ObjectHelper.php it is apparent that the function is not expecting an array. How do I select multiple objects by default?

  • 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-12T10:05:25+00:00Added an answer on May 12, 2026 at 10:05 am

    object___select ___tag() will accept an integer array corresponding to the object values you want selected. For example:

    <?php
      echo object_select_tag(array(4, 5), 'getId', array (
     'include_blank' => false,
     'related_class' => 'sfGuardPermission',
     'peer_method' => 'doSelect',
     'text_method' => '__toString',
     'control_name' => 'user_customer_permissions_'.$user_customer->getId(),
         'multiple' => true
    ));
      ?>
    

    Will select values 4 and 5 by default. This is not ideal, as the documentation lists the first parameter as $object object select tag (symfony API). So I suppose this can be considered a workaround. Ideally the function would accept an array of objects for the $object parameter when the multiple flag is set to true. This would be consistent with other helper functions.

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

Sidebar

Related Questions

I'm using Symfony and mPDF. I'm trying to integrate both but am running into
What exactly happens when the database attached to symfony goes offline or is unreachable?
For some reason, my generated pages are using for the field name article_id instead
I have a Symfony 1.4 project that I am unable to successsfuly run the
I'm trying to learn Symfony that requires using php in the command line /
I have a bunch of processes owned by apache that are running for days
I am building a simple application using Symfony. The page layout consists of a
These are my enabled mods: alias auth_basic authz_default authz_groupfile authz_host authz_user autoindex deflate dir
I am using PHP + CURL to fetch data from a server in one
My boss asks me to update a domain to adopt Google Apps, now everything

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.