public function testsave()
 {
     error_reporting(E_ERROR | E_PARSE);
     $aosProductCategories = new AOS_Product_Categories();
     $aosProductCategories->name = 'test';
     $aosProductCategories->parent_category_id = 1;
     $aosProductCategories->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($aosProductCategories->id));
     $this->assertEquals(36, strlen($aosProductCategories->id));
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $aosProductCategories->mark_deleted($aosProductCategories->id);
     $result = $aosProductCategories->retrieve($aosProductCategories->id);
     $this->assertEquals(null, $result);
 }
 function save($check_notify = FALSE)
 {
     if ($this->is_parent) {
         $this->clearParent();
     } else {
         $tmp = $this;
         while ($tmp && $tmp->parent_category_id) {
             if ($tmp->parent_category_id == $this->id) {
                 $this->clearParent();
                 break;
             }
             $tmp = new AOS_Product_Categories();
             $tmp->retrieve($tmp->parent_category_id);
         }
     }
     parent::save($check_notify);
 }