public static function createType($type) { $map = Location\TypeTable::getMap($type); if (is_array($type)) { foreach ($type as $fld => $val) { if (!isset($map[$fld])) { unset($type[$fld]); } } } $res = Location\TypeTable::add($type); if (!$res->isSuccess()) { throw new Main\SystemException('Type creation failed: ' . implode(', ', $res->getErrorMessages())); } return $res->getId(); }