File modules/cms/model/ModelFactory.class.php

Last commit: Sun Sep 27 04:09:05 2020 +0200	Jan Dankert	Refactoring: The tree functions should use normal templates as the other actions. Beware of the JS hell.
1 <?php 2 3 namespace cms\model; 4 5 class ModelFactory 6 { 7 /** 8 * @param $type 9 * @param $id 10 * @return ModelBase 11 */ 12 public static function create($type, $id) { 13 14 // 'aBc' => 'Abc' 15 $className = '\\cms\\model\\'.ucfirst(strtolower($type)); 16 17 if ( ! class_exists($className)) 18 return null; 19 20 return new $className( $id ); 21 } 22 }
Download modules/cms/model/ModelFactory.class.php
History Sun, 27 Sep 2020 04:09:05 +0200 Jan Dankert Refactoring: The tree functions should use normal templates as the other actions. Beware of the JS hell. Sun, 23 Feb 2020 04:01:30 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 1: moving.