Author: jablko
Date: Mon Oct 25 12:02:01 2010
New Revision: 8475

Log:
Taxonomy isn't a QubitObject

Modified:
   trunk/apps/qubit/modules/term/actions/editAction.class.php

Modified: trunk/apps/qubit/modules/term/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/editAction.class.php  Mon Oct 25 
12:01:26 2010        (r8474)
+++ trunk/apps/qubit/modules/term/actions/editAction.class.php  Mon Oct 25 
12:02:01 2010        (r8475)
@@ -45,8 +45,6 @@
     $this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
 
     $this->resource = new QubitTerm;
-    $this->resource->parentId = QubitTerm::ROOT_ID;
-
     if (isset($this->getRoute()->resource))
     {
       $this->resource = $this->getRoute()->resource;
@@ -187,7 +185,7 @@
           $this->form->setDefault('taxonomy', $this->request->taxonomy);
 
           $params = 
$this->context->routing->parse(Qubit::pathInfo($this->request->taxonomy));
-          $choices[$this->request->taxonomy] = $params['_sf_route']->resource;
+          $choices[$this->request->taxonomy] = 
QubitTaxonomy::getById($params['id']);
         }
 
         $this->form->setWidget('taxonomy', new 
sfWidgetFormSelect(array('choices' => $choices)));
@@ -314,14 +312,25 @@
         break;
 
       case 'parent':
+        $this->resource->parentId = QubitTerm::ROOT_ID;
+
+        $value = $this->form->getValue('parent');
+        if (isset($value))
+        {
+          $params = $this->context->routing->parse(Qubit::pathInfo($value));
+          $this->resource['parent'] = $params['_sf_route']->resource;
+        }
+
+        break;
+
       case 'taxonomy':
-        unset($this->resource[$name]);
+        unset($this->resource->taxonomy);
 
-        $value = $this->form->getValue($field->getName());
+        $value = $this->form->getValue('taxonomy');
         if (isset($value))
         {
           $params = $this->context->routing->parse(Qubit::pathInfo($value));
-          $this->resource[$field->getName()] = $params['_sf_route']->resource;
+          $this->resource->taxonomyId = $params['id'];
         }
 
         break;
@@ -359,7 +368,7 @@
         break;
 
       case 'useFor':
-        $value = $filtered = $this->form->getValue($field->getName());
+        $value = $filtered = $this->form->getValue('useFor');
 
         foreach ($this->useFor as $item)
         {

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to