コード例 #1
0
 private function loadDimensionMap(MultimeterDimension $table, array $names)
 {
     $hashes = array();
     foreach ($names as $name) {
         $hashes[] = PhabricatorHash::digestForIndex($name);
     }
     $objects = $table->loadAllWhere('nameHash IN (%Ls)', $hashes);
     $map = mpull($objects, 'getID', 'getName');
     $need = array();
     foreach ($names as $name) {
         if (isset($map[$name])) {
             continue;
         }
         $need[$name] = $name;
     }
     foreach ($need as $name) {
         $object = id(clone $table)->setName($name)->save();
         $map[$name] = $object->getID();
     }
     return $map;
 }
コード例 #2
0
 private function newMissingDimension(MultimeterDimension $dim, $id)
 {
     $dim->setName('<missing:' . $id . '>');
     return $dim;
 }