$10
Nested set categories, related category items, sfDoctrineChoice
I'm using doctrine nested sets to manage a template category hierarchy, however I also need to get out the actual templates that are in those categories using the sfWidgetFormDoctrineChoice on the forms.
So, how would I go about creating a dropdown for the form that outputs the TemplateCategory and corresponding Templates, so that I can select templates to load? Ideally, template categories would not be selectable.
Here is what I want the resulting dropdown to look like:
TemplateCategoryRoot
-- Template 1
-- TemplateCategory1
---- Template 2
---- Template 3
-- Template Category2
----Template4
---- Template Subcategory1
------ Template 5
So, how would I go about creating a dropdown for the form that outputs the TemplateCategory and corresponding Templates, so that I can select templates to load? Ideally, template categories would not be selectable.
Here is what I want the resulting dropdown to look like:
TemplateCategoryRoot
-- Template 1
-- TemplateCategory1
---- Template 2
---- Template 3
-- Template Category2
----Template4
---- Template Subcategory1
------ Template 5
Template:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
name: { type: string(150) }
content: { type: clob(65532) }
template_category_id: { type: integer(4) }
relations:
TemplateCategory: { local: template_category_id, foreign: id}
TemplateCategory:
actAs:
NestedSet:
hasManyRoots: true,
rootColumnName: root_id
columns:
id: { type: integer(4), primary: true, autoincrement: true }
name: { type: string(150) }
is_public: { type: boolean }
bmv82 | 05/07/10 at 11:54am |
Answers | Tags
(3) Possible Answers Submitted...
You must be logged in to view answers or answer this question.


