* @deprecated */ class ModelManager { const CONFIG_KEY = 'ontology'; /** * @return Model */ public static function getModel() { return ServiceManager::getServiceManager()->get(Ontology::SERVICE_ID); } /** * @param Ontology $model */ public static function setModel(Model $model) { return ServiceManager::getServiceManager()->register(Ontology::SERVICE_ID, $model); } protected static function model2array(Model $model) { $className = get_class($model); return [ 'class' => $className, 'config' => $model->getOptions() ]; } protected static function array2model($array) { if (!isset($array['class']) || !isset($array['config']) || !is_array($array['config'])) { throw new \common_exception_Error('Illegal model array'); } $className = $array['class']; return new $className($array['config']); } }