123 protected static function addMethod($methodName, $methodType)
125 $connection = Main\Application::getConnection();
126 $helper = $connection->getSqlHelper();
128 $sqlTableName = static::getTableName();
129 $sqlMethodName = $helper->forSql($methodName);
130 $sqlMethodType = in_array(
132 static::METHOD_TYPE_METHOD,
133 static::METHOD_TYPE_EVENT,
134 static::METHOD_TYPE_PLACEMENT,
135 static::METHOD_TYPE_ROBOT,
136 static::METHOD_TYPE_ACTIVITY,
140 $query =
"INSERT IGNORE INTO {$sqlTableName} (NAME, METHOD_TYPE) VALUES ('{$sqlMethodName}', '{$sqlMethodType}')";
141 $connection->query($query);
146 $managedCache = Main\Application::getInstance()->getManagedCache();
147 $cacheId =
'stat_method_cache';
151 static::$methodCache =
null;
152 $managedCache->clean($cacheId);
155 if(static::$methodCache ===
null)
157 if($managedCache->read(86400, $cacheId))
159 static::$methodCache = $managedCache->get($cacheId);
163 static::$methodCache = array();
164 $dbRes = static::getList();
165 while($method = $dbRes->fetch())
167 static::$methodCache[$method[
'NAME']] = $method[
'ID'];
169 $managedCache->set($cacheId, static::$methodCache);