سؤال

I have article admin module and a tag module Tags are simply a single tag per row item

What I'd like to do is to embed the list of all the tags (as checkboxes) into my article module

Could I do this with embedded forms?

EDIT:

This is my schema:

article:
  id:                                      ~
  title:                                   { type: VARCHAR, size: '255', required: true }
  tags:                                    { type: VARCHAR, size: '500' }
  created_at:                              { type: TIMESTAMP, required: true }
  updated_at:                              { type: TIMESTAMP, required: true }

tag:
  id:                                      ~
  tag:                                     { type: VARCHAR, size: '500', required: true } 
  ord_id:                                  { type: INTEGER,  required: true }
  created_at:                              ~
  updated_at:                              ~

item_tag:
  id:                                      ~
  item_id:                                 { type: INTEGER, required: true, foreignTable: item, foreignReference: id, onDelete: cascade }
  tag_id:                                  { type: INTEGER, required: true, foreignTable: tag, foreignReference: id, onDelete: restrict }
  created_at:                              ~

item:
  id:                                      ~
  article_id:                              { type: INTEGER, foreignTable: article, foreignReference: id, onDelete: cascade }

So when I need the tags to be displayed and will update the above tables

هل كانت مفيدة؟

المحلول

If you have defined the relationship between the article and tags correctly in your model, then the generated Forms should contain tag select widgets.

Search "sfWidgetFormChoice" in the Forms documentation for more information: http://www.symfony-project.org/jobeet/1_4/Doctrine/en/10

Note: The examples are created using the Doctrine ORM but everything should work the same way with Propel as well.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top