Company categ may not link to main general categ.
authorGusa <gu.martinm@gmail.com>
Sat, 15 Dec 2012 03:10:20 +0000 (04:10 +0100)
committerGusa <gu.martinm@gmail.com>
Sat, 15 Dec 2012 03:10:20 +0000 (04:10 +0100)
lib/form/doctrine/CompanyCategoryForm.class.php

index 2fee475..f530850 100644 (file)
@@ -28,12 +28,22 @@ class CompanyCategoryForm extends BaseCompanyCategoryForm
                                                                                   'add_empty' => false,
                                                                                   'query'     => $companyCategs));
 
+    $this->widgetSchema['general_categ_id'] = new sfWidgetFormDoctrineChoice(array('model'     => $this->getRelatedModelName('GeneralCategory'),
+                                                                                   'add_empty' => true,
+                                                                                   'query'     => GeneralCategoryTable::getInstance()->getGeneralCategoriesByLftQuery()));
+
+
     $this->widgetSchema['company_categ_description'] = new sfWidgetFormTextarea();
 
     $this->validatorSchema['parent_category'] = new sfValidatorDoctrineChoice(array('model'    => $this->getModelName(),
                                                                                     'required' => true,
                                                                                     'query'    => $companyCategs));
 
+    $this->validatorSchema['general_categ_id'] = new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('GeneralCategory'),
+                                                                                     'required' => false,
+                                                                                     'query'     => GeneralCategoryTable::getInstance()->getGeneralCategoriesByLftQuery()));
+
+
 
     $this->widgetSchema->setLabels(array('parent_category'  => 'Parent Company Category'));
     $this->widgetSchema->setLabels(array('general_categ_id' => 'General Category'));