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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:56:59+00:00 2026-06-11T09:56:59+00:00

I have setup 3 tables in symfony: A flipbook table, A Skills table, and

  • 0

I have setup 3 tables in symfony:

A flipbook table, A Skills table, and a relations table, to connect each skill id with each flipbook id.

WHen I built the model, symfony constructed everything correctly, and by default gave a drop-down menu for the skills, which had all skills from the skills table as options. You can select an option and it creates the appropriate relationships.

I need the skills to be checkboxes for multiple selections rather than a single selection drop-down menu, so I am using the sfWidgetFormSelectCheckbox widget.

The documentation says to use “choices” to populate the multiple selections like so:

$this->widgetSchema['skill_id'] = new sfWidgetFormSelectCheckbox(
  array('choices' => "choice1", "choice2", choice3"), 
  array('class' => 'text size-500'));

I do not know how to load the choices from the skills table in the choices array. I know they are in there somewhere, because they are included initially in the default widget. How do I pull them out to individual checkbox input elements, where the values match the skill_id.

How about some code?

Schema:

Flipbook:
  tableName: flipbook
  inheritance:
    extends: SvaGeneric
    type: concrete
  columns:
    title: { type: string(255) }
    career_associations: { type: clob }
    skills: { type: string(255) }
    skills_associations: { type: clob }
    program: { type: string(255) }
    program_associations: { type: clob }
    draft_id: { type: integer(10) }

FlipbookSkills:
  tableName: flipbook_skills
  columns:
    title: { type: string(255) }
  relations:
    Flipbook:
      foreignAlias: flipbook_skills
      alias: skills
      local: title
      onDelete: SET NULL   

FlipbookSkillRelations:
  tableName: flipbook_skill_relations
  actAs:
    SoftDelete: ~
  options:
  columns:
    flipbook_id: { type: integer(10), notnull: false }
    skill_id: { type: integer(10), notnull: false }
  relations:
    Flipbook:
      foreignAlias: flipbook_skills_flipbook
      alias: flipbook
      local: flipbook_id
      onDelete: CASCADE
    FlipbookSkills:
      foreignAlias: flipbook_skills_skills
      alias: flipbookskills
      local: skill_id
      onDelete: CASCADE

FlipbookSkillsRelationsForm.class.php:

$this->widgetSchema['flipbook_id'] = new sfWidgetFormInputText(array(), array('class' => 'text size-500'));

$this->widgetSchema['skill_id'] = new sfWidgetFormSelectCheckbox(array('choices' => "**WHAT GOES HERE??**"), array('class' => 'text size-500'));


$useFields = array(
  'flipbook_id',
  'skill_id',
);

$this->useFields($useFields);

Let me know if I should provide further code or explanation.

UPDATE

Here is the FlipbookSkillsTable.class generated in the model:

<?php

/**
 * FlipbookSkillsTable
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class FlipbookSkillsTable extends Doctrine_Table
{
    /**
     * Returns an instance of this class.
     *
     * @return object FlipbookSkillsTable
     */
    public static function getInstance()
    {
        return Doctrine_Core::getTable('FlipbookSkills');
    }

    public function retrieveForFilter()
    {
      $res = $this->createQuery('s')
        ->select('s.id, s.name')
        ->orderBy('s.name ASC')
        ->execute(array(), Doctrine_Core::HYDRATE_NONE);

      // if you want an empty line
      $rets = array('' => '');
      foreach ($res as $ret)
      {
        $rets[$ret[0]] = $ret[1];
      }

      return $rets;
    }

    public function getAllFlipbookSkills() {
        $allSkills = Doctrine_Query::create()
            ->from('FlipbookSkills')
            ->orderBy('title ASC')
            ->execute();
    return $allSkills;
    }
}

I cannot seem to call any function from this file without getting the “Undefined Method” error. I guess this would be a schema error?

UPDATE 2

This is what is working correctly:

$this->widgetSchema['skill_id'] = new sfWidgetFormSelectCheckbox(array('choices' => Doctrine::getTable('FlipbookSkills')->getFlipbookskills()), array('class' => 'text size-500'));
  • 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-06-11T09:57:00+00:00Added an answer on June 11, 2026 at 9:57 am

    I usually do it in this way:

    Add a custom method to retrieve an array of skill inside the SkillTable.class.php, something like:

      /**
       * Retrieve array for display the select list for filter
       *
       * @return array
       */
      public function getFlipbookskills()
      {
        $res = $this->createQuery('s')
          ->select('s.id, s.name')
          ->orderBy('s.name ASC')
          ->execute(array(), Doctrine_Core::HYDRATE_NONE);
    
        // if you want an empty line
        $rets = array('' => '');
        foreach ($res as $ret)
        {
          $rets[$ret[0]] = $ret[1];
        }
    
        return $rets;
      }
    

    Then in your form, call it like :

    $this->widgetSchema['skill_id'] = new sfWidgetFormSelectCheckbox(
      array('choices' => Doctrine::getTable('FlipbookSkills')->getFlipbookskills()), 
      array('class' => 'text size-500')
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have symfony 1.4 installed and had setup my own user model (table). Now,
Here's my toy setup. I have 3 tables. One table is a guest list
I have those tables setup : http://pastie.org/627764 ... # This is the association table
I have two tables, one table has some information in each row along with
The Setup I have two tables, USERS and PETS . each user has an
Curious whether folks have setup 2 way transactional replication on the tables ASP.NET uses
i have a number of Tables setup in SQl Server i have transferred all
I need some advice of how to setup my tables I currently have a
I have set up 2 two tables - table userid and table data in
I have the following setup: Table: Question QuestionId Table: QuestionTag QuestionId TagId Table: Tag

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.