public function unitListAction()
 {
     $list = new \Pimcore\Model\Object\QuantityValue\Unit\Listing();
     $list->setOrderKey("abbreviation");
     $list->setOrder("ASC");
     if ($this->getParam("filter")) {
         $array = explode(",", $this->getParam("filter"));
         $quotedArray = array();
         $db = \Pimcore\Db::get();
         foreach ($array as $a) {
             $quotedArray[] = $db->quote($a);
         }
         $string = implode(",", $quotedArray);
         $list->setCondition("id IN (" . $string . ")");
     }
     $units = $list->getUnits();
     $this->_helper->json(array("data" => $units, "success" => true, "total" => $list->getTotalCount()));
 }
示例#2
0
 public function configureOptions()
 {
     if (!$this->validUnits) {
         $list = new \Pimcore\Model\Object\QuantityValue\Unit\Listing();
         $units = $list->getUnits();
         if (is_array($units)) {
             $this->validUnits = [];
             /** @var  $unit Model\Object\QuantityValue\Unit */
             foreach ($units as $unit) {
                 $this->validUnits[] = $unit->getId();
             }
         }
     }
 }