예제 #1
0
 static function getCategoryIds($id)
 {
     return OsEntity::getCategoryIds($id);
 }
예제 #2
0
 public function executeAddIndustry($request)
 {
     $this->checkEntity($request, false, false);
     if ($request->isMethod('post')) {
         $catId = $request->getParameter('category');
         $count = LsDoctrineQuery::create()->from('OsCategory c')->where('c.category_id = ?', $catId)->count();
         if (!$count) {
             $this->forward404();
         }
         if (!in_array($catId, OsEntity::getCategoryIds($this->entity['id']))) {
             $ec = new OsEntityCategory();
             $ec->entity_id = $this->entity['id'];
             $ec->category_id = $catId;
             $ec->source = "user_id: " . $this->getUser()->getGuardUser()->id;
             $ec->save();
         }
         $this->redirect(EntityTable::getInternalUrl($this->entity, 'editIndustries'));
     }
     $this->categories = Doctrine::getTable('OsCategory')->findAll(Doctrine::HYDRATE_ARRAY);
     usort($this->categories, array('OsCategoryTable', 'categoryCmp'));
     $this->existing_category_ids = OsEntity::getCategoryIds($this->entity['id']);
 }