YService.class.php 673 Bytes
<?phpclass Framework_YService
{
	/**
	 * 配置
	 * @var Array
	 */
	private static $_configs = array();
	/**
	 * Dao
	 * @var Q_Dao_Mysql_SqlMap_MapQuery | Q_Dao_Mongo_Query
	*/
	private static $_services;
	public static function factory($dbname = null, $configPath = null)
	{
		$config = array(
				'dbname' => $dbname,
				'configPath' => $configPath
		);
		if(array_key_exists($dbname, self::$_configs))
		{
			self::$_services[$dbname]->ping();
			return self::$_services[$dbname];
		}
		self::$_configs[$dbname] = $config;
		self::$_services[$dbname] = new Util_Dao_SqlMap_MapQuery ($config['dbname'], $config['configPath']);
		return self::$_services[$dbname];
	}
}