示例#1
0
/**
 * Writes the meta-data to files
 *
 * @param string $key
 * @param array $data
 */
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Files, write){

	zval **key, **data, *meta_data_dir, *virtual_key;
	zval *path, *php_export, *status;
	smart_str exp = { NULL, 0, 0 };

	phalcon_fetch_params_ex(2, 0, &key, &data);

	PHALCON_MM_GROW();

	meta_data_dir = phalcon_fetch_nproperty_this(this_ptr, SL("_metaDataDir"), PH_NOISY TSRMLS_CC);
	
	PHALCON_INIT_VAR(virtual_key);
	phalcon_prepare_virtual_path_ex(virtual_key, Z_STRVAL_PP(key), Z_STRLEN_PP(key), '_' TSRMLS_CC);
	
	PHALCON_INIT_VAR(path);
	PHALCON_CONCAT_VVS(path, meta_data_dir, virtual_key, ".php");
	
	smart_str_appends(&exp, "<?php return ");
	php_var_export_ex(data, 0, &exp TSRMLS_CC);
	smart_str_appendc(&exp, ';');
	smart_str_0(&exp);
	
	PHALCON_INIT_VAR(php_export);
	ZVAL_STRINGL(php_export, exp.c, exp.len, 0);

	PHALCON_INIT_VAR(status);
	phalcon_file_put_contents(status, path, php_export TSRMLS_CC);
	if (PHALCON_IS_FALSE(status)) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Meta-Data directory cannot be written");
		return;
	}
	
	PHALCON_MM_RESTORE();
}
示例#2
0
/**
 * Reads parsed annotations from files
 *
 * @param string $key
 * @return array
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Files, read){

	zval *key, *annotations_dir, *separator, *virtual_key;
	zval *path, *data;

	PHALCON_MM_GROW();

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &key) == FAILURE) {
		RETURN_MM_NULL();
	}

	PHALCON_OBS_VAR(annotations_dir);
	phalcon_read_property_this(&annotations_dir, this_ptr, SL("_annotationsDir"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(separator);
	ZVAL_STRING(separator, "_", 1);
	
	PHALCON_INIT_VAR(virtual_key);
	phalcon_prepare_virtual_path(virtual_key, key, separator TSRMLS_CC);
	
	PHALCON_INIT_VAR(path);
	PHALCON_CONCAT_VVS(path, annotations_dir, virtual_key, ".php");
	if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) {
		PHALCON_INIT_VAR(data);
		if (phalcon_require_ret(data, path TSRMLS_CC) == FAILURE) {
			return;
		}
		RETURN_CCTOR(data);
	}
	
	RETURN_MM_NULL();
}
示例#3
0
/**
 * Writes parsed annotations to files
 *
 * @param string $key
 * @param Phalcon\Annotations\Reflection $data
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Files, write){

	zval *key, *data, annotations_dir = {}, virtual_key = {}, path = {}, php_export = {}, status = {};
	smart_str exp = { 0 };

	phalcon_fetch_params(0, 2, 0, &key, &data);
	PHALCON_ENSURE_IS_STRING(key);

	phalcon_return_property(&annotations_dir, getThis(), SL("_annotationsDir"));
	
	/** 
	 * Paths must be normalized before be used as keys
	 */
	phalcon_prepare_virtual_path_ex(&virtual_key, Z_STRVAL_P(key), Z_STRLEN_P(key), '_');

	PHALCON_CONCAT_VVS(&path, &annotations_dir, &virtual_key, ".php");
	
	smart_str_appends(&exp, "<?php return ");
	php_var_export_ex(data, 0, &exp);
	smart_str_appendc(&exp, ';');
	smart_str_0(&exp);

	ZVAL_STR(&php_export, exp.s);

	phalcon_file_put_contents(&status, &path, &php_export);
	if (PHALCON_IS_FALSE(&status)) {
		PHALCON_THROW_EXCEPTION_STRW(phalcon_annotations_exception_ce, "Annotations directory cannot be written");
		return;
	}
}
示例#4
0
/**
 * Reads meta-data from files
 *
 * @param string $key
 * @return array
 */
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Files, read){

	zval **key, *meta_data_dir, *virtual_key;
	zval *path, *data = NULL;

	phalcon_fetch_params_ex(1, 0, &key);
	PHALCON_ENSURE_IS_STRING(key);

	PHALCON_MM_GROW();

	meta_data_dir = phalcon_fetch_nproperty_this(this_ptr, SL("_metaDataDir"), PH_NOISY TSRMLS_CC);
	
	PHALCON_INIT_VAR(virtual_key);
	phalcon_prepare_virtual_path_ex(virtual_key, Z_STRVAL_PP(key), Z_STRLEN_PP(key), '_' TSRMLS_CC);
	
	PHALCON_INIT_VAR(path);
	PHALCON_CONCAT_VVS(path, meta_data_dir, virtual_key, ".php");
	
	if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) {
		RETURN_MM_ON_FAILURE(phalcon_require_ret(&data, Z_STRVAL_P(path) TSRMLS_CC));
		RETVAL_ZVAL(data, 1, 1);
	}
	
	PHALCON_MM_RESTORE();
}
示例#5
0
文件: files.c 项目: RSivakov/cphalcon
/**
 * Reads parsed annotations from files
 *
 * @param string $key
 * @return Phalcon\Annotations\Reflection
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Files, read){

	zval *key, *annotations_dir, *separator, *virtual_key;
	zval *path, *data;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 0, &key);
	
	PHALCON_OBS_VAR(annotations_dir);
	phalcon_read_property_this(&annotations_dir, this_ptr, SL("_annotationsDir"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(separator);
	ZVAL_STRING(separator, "_", 1);
	
	/** 
	 * Paths must be normalized before be used as keys
	 */
	PHALCON_INIT_VAR(virtual_key);
	phalcon_prepare_virtual_path(virtual_key, key, separator TSRMLS_CC);
	
	PHALCON_INIT_VAR(path);
	PHALCON_CONCAT_VVS(path, annotations_dir, virtual_key, ".php");
	
	if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) {
		PHALCON_INIT_VAR(data);
		if (phalcon_require_ret(data, path TSRMLS_CC) == FAILURE) {
			return;
		}
		RETURN_CCTOR(data);
	}
	
	RETURN_MM_NULL();
}
示例#6
0
文件: files.c 项目: RSivakov/cphalcon
/**
 * Writes parsed annotations to files
 *
 * @param string $key
 * @param Phalcon\Annotations\Reflection $data
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Files, write){

	zval *key, *data, *annotations_dir, *separator;
	zval *virtual_key, *path, *to_string, *export, *php_export;
	zval *status;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 2, 0, &key, &data);
	
	PHALCON_OBS_VAR(annotations_dir);
	phalcon_read_property_this(&annotations_dir, this_ptr, SL("_annotationsDir"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(separator);
	ZVAL_STRING(separator, "_", 1);
	
	/** 
	 * Paths must be normalized before be used as keys
	 */
	PHALCON_INIT_VAR(virtual_key);
	phalcon_prepare_virtual_path(virtual_key, key, separator TSRMLS_CC);
	
	PHALCON_INIT_VAR(path);
	PHALCON_CONCAT_VVS(path, annotations_dir, virtual_key, ".php");
	
	PHALCON_INIT_VAR(to_string);
	ZVAL_BOOL(to_string, 1);
	
	PHALCON_INIT_VAR(export);
	phalcon_call_func_p2(export, "var_export", data, to_string);
	
	PHALCON_INIT_VAR(php_export);
	PHALCON_CONCAT_SVS(php_export, "<?php return ", export, "; ");
	
	PHALCON_INIT_VAR(status);
	phalcon_file_put_contents(status, path, php_export TSRMLS_CC);
	if (PHALCON_IS_FALSE(status)) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_annotations_exception_ce, "Annotations directory cannot be written");
		return;
	}
	
	PHALCON_MM_RESTORE();
}
示例#7
0
/**
 * Writes parsed annotations to files
 *
 * @param string $key
 * @param array $data
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Files, write){

	zval *key, *data, *annotations_dir, *separator;
	zval *virtual_key, *path, *to_string, *export, *php_export;
	zval *status;

	PHALCON_MM_GROW();

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &key, &data) == FAILURE) {
		RETURN_MM_NULL();
	}

	PHALCON_OBS_VAR(annotations_dir);
	phalcon_read_property_this(&annotations_dir, this_ptr, SL("_annotationsDir"), PH_NOISY_CC);
	
	PHALCON_INIT_VAR(separator);
	ZVAL_STRING(separator, "_", 1);
	
	PHALCON_INIT_VAR(virtual_key);
	phalcon_prepare_virtual_path(virtual_key, key, separator TSRMLS_CC);
	
	PHALCON_INIT_VAR(path);
	PHALCON_CONCAT_VVS(path, annotations_dir, virtual_key, ".php");
	
	PHALCON_INIT_VAR(to_string);
	ZVAL_BOOL(to_string, 1);
	
	PHALCON_INIT_VAR(export);
	PHALCON_CALL_FUNC_PARAMS_2(export, "var_export", data, to_string);
	
	PHALCON_INIT_VAR(php_export);
	PHALCON_CONCAT_SVS(php_export, "<?php return ", export, "; ");
	
	PHALCON_INIT_VAR(status);
	PHALCON_CALL_FUNC_PARAMS_2(status, "file_put_contents", path, php_export);
	if (PHALCON_IS_FALSE(status)) {
		PHALCON_THROW_EXCEPTION_STR(phalcon_annotations_exception_ce, "Annotations directory cannot be written");
		return;
	}
	
	PHALCON_MM_RESTORE();
}
示例#8
0
/**
 * Reads parsed annotations from files
 *
 * @param string $key
 * @return Phalcon\Annotations\Reflection
 */
PHP_METHOD(Phalcon_Annotations_Adapter_Files, read){

	zval *key, annotations_dir = {}, virtual_key = {}, path = {};

	phalcon_fetch_params(0, 1, 0, &key);
	PHALCON_ENSURE_IS_STRING(key);

	phalcon_return_property(&annotations_dir, getThis(), SL("_annotationsDir"));
	
	/** 
	 * Paths must be normalized before be used as keys
	 */
	phalcon_prepare_virtual_path_ex(&virtual_key, Z_STRVAL_P(key), Z_STRLEN_P(key), '_');
	
	PHALCON_CONCAT_VVS(&path, &annotations_dir, &virtual_key, ".php");
	
	if (phalcon_file_exists(&path) == SUCCESS) {
		RETURN_ON_FAILURE(phalcon_require_ret(return_value, Z_STRVAL(path)));
		return;
	}
}
示例#9
0
/**
 * Dispatches a controller action taking into account the routing parameters
 *
 * @param Phalcon_Request $request
 * @param Phalcon_Response $response
 * @param Phalcon_View $view
 * @param Phalcon_Model_Manager $model
 * @return Phalcon_Controller
 */
PHP_METHOD(Phalcon_Dispatcher, dispatch){

	zval *request = NULL, *response = NULL, *view = NULL, *model = NULL, *controllers_dir = NULL;
	zval *value = NULL, *controller = NULL, *number_dispatches = NULL;
	zval *controller_name = NULL, *controllers = NULL, *controller_class = NULL;
	zval *controller_path = NULL, *params = NULL, *action_name = NULL;
	zval *action_method = NULL;
	zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL, *r5 = NULL, *r6 = NULL;
	zval *r7 = NULL, *r8 = NULL, *r9 = NULL, *r10 = NULL, *r11 = NULL, *r12 = NULL;
	zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *t5 = NULL, *t6 = NULL;
	zval *t7 = NULL, *t8 = NULL, *t9 = NULL, *t10 = NULL;
	zval *c0 = NULL, *c1 = NULL, *c2 = NULL;
	zval *i0 = NULL;
	zval *a0 = NULL, *a1 = NULL;
	zval *p0[] = { NULL, NULL, NULL, NULL, NULL };
	int eval_int;
	zend_class_entry *ce0;

	PHALCON_MM_GROW();
	
	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|zz", &request, &response, &view, &model) == FAILURE) {
		PHALCON_MM_RESTORE();
		RETURN_NULL();
	}

	if (!view) {
		PHALCON_INIT_VAR(view);
		ZVAL_NULL(view);
	}
	
	if (!model) {
		PHALCON_INIT_VAR(model);
		ZVAL_NULL(model);
	}
	
	PHALCON_ALLOC_ZVAL_MM(r0);
	PHALCON_ALLOC_ZVAL_MM(t0);
	phalcon_read_property(&t0, this_ptr, SL("_basePath"), PHALCON_NOISY TSRMLS_CC);
	PHALCON_ALLOC_ZVAL_MM(t1);
	phalcon_read_property(&t1, this_ptr, SL("_controllersDir"), PHALCON_NOISY TSRMLS_CC);
	PHALCON_CONCAT_VV(r0, t0, t1);
	PHALCON_CPY_WRT(controllers_dir, r0);
	
	PHALCON_INIT_VAR(value);
	ZVAL_NULL(value);
	
	PHALCON_INIT_VAR(controller);
	ZVAL_NULL(controller);
	
	PHALCON_INIT_VAR(number_dispatches);
	ZVAL_LONG(number_dispatches, 0);
	phalcon_update_property_bool(this_ptr, SL("_finished"), 0 TSRMLS_CC);
	ws_e10f_0:
		
		PHALCON_INIT_VAR(t2);
		phalcon_read_property(&t2, this_ptr, SL("_finished"), PHALCON_NOISY TSRMLS_CC);
		if (zend_is_true(t2)) {
			goto we_e10f_0;
		}
		phalcon_update_property_bool(this_ptr, SL("_finished"), 1 TSRMLS_CC);
		
		PHALCON_INIT_VAR(t3);
		phalcon_read_property(&t3, this_ptr, SL("_controllerName"), PHALCON_NOISY TSRMLS_CC);
		PHALCON_CPY_WRT(controller_name, t3);
		if (!zend_is_true(controller_name)) {
			PHALCON_INIT_VAR(t4);
			phalcon_read_property(&t4, this_ptr, SL("_defaultController"), PHALCON_NOISY TSRMLS_CC);
			PHALCON_CPY_WRT(controller_name, t4);
			phalcon_update_property_zval(this_ptr, SL("_controllerName"), controller_name TSRMLS_CC);
		}
		
		PHALCON_INIT_VAR(t5);
		phalcon_read_property(&t5, this_ptr, SL("_controllers"), PHALCON_NOISY TSRMLS_CC);
		PHALCON_CPY_WRT(controllers, t5);
		
		PHALCON_INIT_VAR(r1);
		
		PHALCON_INIT_VAR(r2);
		PHALCON_CALL_STATIC_PARAMS_1(r2, "phalcon_text", "camelize", controller_name);
		PHALCON_CONCAT_VS(r1, r2, "Controller");
		PHALCON_CPY_WRT(controller_class, r1);
		eval_int = phalcon_array_isset(controllers, controller_class);
		if (!eval_int) {
			PHALCON_INIT_VAR(c0);
			ZVAL_BOOL(c0, 0);
			PHALCON_INIT_VAR(r3);
			PHALCON_CALL_FUNC_PARAMS_2(r3, "class_exists", controller_class, c0);
			if (!zend_is_true(r3)) {
				PHALCON_INIT_VAR(r4);
				PHALCON_CONCAT_VVS(r4, controllers_dir, controller_class, ".php");
				PHALCON_CPY_WRT(controller_path, r4);
				if (phalcon_file_exists(controller_path TSRMLS_CC) == SUCCESS) {
					if (phalcon_require(controller_path TSRMLS_CC) == FAILURE) {
						return;
					}
				} else {
					PHALCON_INIT_VAR(r5);
					PHALCON_CONCAT_SVS(r5, "File for controller class ", controller_class, " doesn't exist");
					PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "_throwdispatchexception", response, r5, PHALCON_NO_CHECK);
				}
				
				PHALCON_INIT_VAR(c1);
				ZVAL_BOOL(c1, 0);
				
				PHALCON_INIT_VAR(r6);
				PHALCON_CALL_FUNC_PARAMS_2(r6, "class_exists", controller_class, c1);
				if (!zend_is_true(r6)) {
					PHALCON_INIT_VAR(r7);
					PHALCON_CONCAT_SVS(r7, "Class ", controller_class, " was not found on controller file");
					PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "_throwdispatchexception", response, r7, PHALCON_NO_CHECK);
				}
			}
			ce0 = phalcon_fetch_class(controller_class TSRMLS_CC);
			
			PHALCON_INIT_VAR(i0);
			object_init_ex(i0, ce0);
			p0[0] = this_ptr;
			p0[1] = request;
			p0[2] = response;
			p0[3] = view;
			p0[4] = model;
			PHALCON_CALL_METHOD_PARAMS_NORETURN(i0, "__construct", 5, p0, PHALCON_CHECK);
			PHALCON_CPY_WRT(controller, i0);
			if (phalcon_method_exists_ex(controller, SL("initialize") TSRMLS_CC) == SUCCESS) {
				PHALCON_CALL_METHOD_NORETURN(controller, "initialize", PHALCON_NO_CHECK);
			}
			
			PHALCON_INIT_VAR(t6);
			phalcon_read_property(&t6, this_ptr, SL("_controllers"), PHALCON_NOISY TSRMLS_CC);
			phalcon_array_update(&t6, controller_class, &controller, PHALCON_NO_SEPARATE_THX, PHALCON_COPY, PHALCON_NO_CTOR TSRMLS_CC);
			phalcon_update_property_zval(this_ptr, SL("_controllers"), t6 TSRMLS_CC);
		} else {
			PHALCON_INIT_VAR(r8);
			phalcon_array_fetch(&r8, controllers, controller_class, PHALCON_NOISY TSRMLS_CC);
			PHALCON_CPY_WRT(controller, r8);
		}
		
		PHALCON_INIT_VAR(t7);
		phalcon_read_property(&t7, this_ptr, SL("_params"), PHALCON_NOISY TSRMLS_CC);
		PHALCON_CPY_WRT(params, t7);
		
		PHALCON_INIT_VAR(t8);
		phalcon_read_property(&t8, this_ptr, SL("_actionName"), PHALCON_NOISY TSRMLS_CC);
		PHALCON_CPY_WRT(action_name, t8);
		if (!zend_is_true(action_name)) {
			PHALCON_INIT_VAR(t9);
			phalcon_read_property(&t9, this_ptr, SL("_defaultAction"), PHALCON_NOISY TSRMLS_CC);
			PHALCON_CPY_WRT(action_name, t9);
			phalcon_update_property_zval(this_ptr, SL("_actionName"), action_name TSRMLS_CC);
		}
		
		if (phalcon_method_exists_ex(controller, SL("beforedispatch") TSRMLS_CC) == SUCCESS) {
			PHALCON_INIT_VAR(r9);
			PHALCON_CALL_METHOD_PARAMS_3(r9, controller, "beforedispatch", controller_name, action_name, params, PHALCON_NO_CHECK);
			if (Z_TYPE_P(r9) == IS_BOOL && !Z_BVAL_P(r9)) {
				PHALCON_INIT_VAR(value);
				ZVAL_BOOL(value, 0);
				goto we_e10f_0;
			}
		}
		
		PHALCON_INIT_VAR(r10);
		PHALCON_CONCAT_VS(r10, action_name, "Action");
		PHALCON_CPY_WRT(action_method, r10);
		if (phalcon_method_exists(controller, action_method TSRMLS_CC) == SUCCESS) {
			PHALCON_INIT_VAR(a0);
			array_init(a0);
			phalcon_array_append(&a0, controller, PHALCON_SEPARATE_PLZ TSRMLS_CC);
			phalcon_array_append(&a0, action_method, PHALCON_SEPARATE_PLZ TSRMLS_CC);
			PHALCON_INIT_VAR(value);
			PHALCON_CALL_FUNC_PARAMS_2(value, "call_user_func_array", a0, params);
		} else {
			if (phalcon_method_exists_ex(controller, SL("notfoundaction") TSRMLS_CC) == SUCCESS) {
				PHALCON_INIT_VAR(a1);
				array_init(a1);
				phalcon_array_append(&a1, controller, PHALCON_SEPARATE_PLZ TSRMLS_CC);
				add_next_index_stringl(a1, SL("notFoundAction"), 1);
				PHALCON_INIT_VAR(value);
				PHALCON_CALL_FUNC_PARAMS_2(value, "call_user_func_array", a1, params);
			} else {
				PHALCON_INIT_VAR(r11);
				PHALCON_CONCAT_SVSVS(r11, "Action '", action_name, "' was not found on controller '", controller_name, "'");
				PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "_throwdispatchexception", response, r11, PHALCON_NO_CHECK);
			}
		}
		
		if (phalcon_method_exists_ex(controller, SL("afterdispatch") TSRMLS_CC) == SUCCESS) {
			PHALCON_CALL_METHOD_PARAMS_3_NORETURN(controller, "afterdispatch", controller_name, action_name, params, PHALCON_NO_CHECK);
		}
		
		PHALCON_SEPARATE(number_dispatches);
		increment_function(number_dispatches);
		
		PHALCON_INIT_VAR(t10);
		ZVAL_LONG(t10, 256);
		
		PHALCON_INIT_VAR(r12);
		is_smaller_function(r12, t10, number_dispatches TSRMLS_CC);
		if (zend_is_true(r12)) {
			PHALCON_INIT_VAR(c2);
			ZVAL_STRING(c2, "Dispatcher has detected a cyclic routing causing stability problems", 1);
			PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "_throwdispatchexception", response, c2, PHALCON_NO_CHECK);
		}
		goto ws_e10f_0;
	we_e10f_0:
	phalcon_update_property_zval(this_ptr, SL("_returnedValue"), value TSRMLS_CC);
	phalcon_update_property_zval(this_ptr, SL("_lastController"), controller TSRMLS_CC);
	
	RETURN_CHECK_CTOR(controller);
}
示例#10
0
文件: loader.c 项目: rcpsec/cphalcon
/**
 * Makes the work of autoload registered classes
 *
 * @param string $className
 * @return boolean
 */
PHP_METHOD(Phalcon_Loader, autoLoad){

	zval *class_name = NULL, *file_name = NULL, *directory = NULL, *preffix = NULL;
	zval *path = NULL;
	zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL;
	zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL, *r5 = NULL, *r6 = NULL;
	zval *r7 = NULL, *r8 = NULL, *r9 = NULL, *r10 = NULL;
	zval *c0 = NULL, *c1 = NULL, *c2 = NULL;
	HashTable *ah0, *ah1;
	HashPosition hp0, hp1;
	zval **hd;
	char *hash_index;
	uint hash_index_len;
	ulong hash_num;
	int hash_type;
	int eval_int;

	PHALCON_MM_GROW();
	
	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &class_name) == FAILURE) {
		PHALCON_MM_RESTORE();
		RETURN_NULL();
	}

	PHALCON_ALLOC_ZVAL_MM(t0);
	phalcon_read_property(&t0, this_ptr, SL("_classes"), PHALCON_NOISY TSRMLS_CC);
	eval_int = phalcon_array_isset(t0, class_name);
	if (eval_int) {
		PHALCON_ALLOC_ZVAL_MM(t1);
		phalcon_read_property(&t1, this_ptr, SL("_classes"), PHALCON_NOISY TSRMLS_CC);
		PHALCON_ALLOC_ZVAL_MM(r0);
		phalcon_array_fetch(&r0, t1, class_name, PHALCON_NOISY TSRMLS_CC);
		PHALCON_CPY_WRT(file_name, r0);
		if (phalcon_require(file_name TSRMLS_CC) == FAILURE) {
			return;
		}
		PHALCON_MM_RESTORE();
		RETURN_TRUE;
	}
	
	PHALCON_ALLOC_ZVAL_MM(t2);
	phalcon_read_property(&t2, this_ptr, SL("_namespaces"), PHALCON_NOISY TSRMLS_CC);
	if (phalcon_valid_foreach(t2 TSRMLS_CC)) {
		ah0 = Z_ARRVAL_P(t2);
		zend_hash_internal_pointer_reset_ex(ah0, &hp0);
		fes_0c08_0:
		if(zend_hash_get_current_data_ex(ah0, (void**) &hd, &hp0) != SUCCESS){
			goto fee_0c08_0;
		} else {
			PHALCON_INIT_VAR(preffix);
			PHALCON_GET_FOREACH_KEY(preffix, ah0, hp0);
		}
		PHALCON_INIT_VAR(directory);
		ZVAL_ZVAL(directory, *hd, 1, 0);
		PHALCON_INIT_VAR(r1);
		PHALCON_CALL_FUNC_PARAMS_1(r1, "strlen", class_name);
		PHALCON_INIT_VAR(r2);
		is_smaller_function(r2, preffix, r1 TSRMLS_CC);
		if (zend_is_true(r2)) {
			PHALCON_INIT_VAR(c0);
			ZVAL_LONG(c0, 0);
			PHALCON_INIT_VAR(r3);
			PHALCON_CALL_FUNC_PARAMS_1(r3, "strlen", preffix);
			PHALCON_INIT_VAR(r4);
			PHALCON_CALL_FUNC_PARAMS_3(r4, "substr", class_name, c0, r3);
			PHALCON_INIT_VAR(r5);
			is_equal_function(r5, r4, preffix TSRMLS_CC);
			if (zend_is_true(r5)) {
				PHALCON_INIT_VAR(r6);
				PHALCON_CONCAT_VS(r6, preffix, "\\");
				PHALCON_INIT_VAR(c1);
				ZVAL_STRING(c1, "", 1);
				PHALCON_INIT_VAR(r7);
				phalcon_fast_str_replace(r7, r6, c1, class_name TSRMLS_CC);
				PHALCON_CPY_WRT(file_name, r7);
				if (zend_is_true(file_name)) {
					PHALCON_INIT_VAR(c2);
					ZVAL_STRING(c2, "\\", 1);
					PHALCON_INIT_VAR(t3);
					zend_get_constant("DIRECTORY_SEPARATOR", strlen("DIRECTORY_SEPARATOR"), t3 TSRMLS_CC);
					PHALCON_INIT_VAR(r8);
					PHALCON_CONCAT_VVS(r8, directory, file_name, ".php");
					PHALCON_INIT_VAR(r9);
					phalcon_fast_str_replace(r9, c2, t3, r8 TSRMLS_CC);
					PHALCON_CPY_WRT(path, r9);
					if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) {
						if (phalcon_require(path TSRMLS_CC) == FAILURE) {
							return;
						}
						PHALCON_MM_RESTORE();
						RETURN_TRUE;
					}
				}
			}
		}
		zend_hash_move_forward_ex(ah0, &hp0);
		goto fes_0c08_0;
		fee_0c08_0:
		if(0){}
	} else {
		return;
	}
	
	PHALCON_ALLOC_ZVAL_MM(t4);
	phalcon_read_property(&t4, this_ptr, SL("_directories"), PHALCON_NOISY TSRMLS_CC);
	if (phalcon_valid_foreach(t4 TSRMLS_CC)) {
		ah1 = Z_ARRVAL_P(t4);
		zend_hash_internal_pointer_reset_ex(ah1, &hp1);
		fes_0c08_1:
		if(zend_hash_get_current_data_ex(ah1, (void**) &hd, &hp1) != SUCCESS){
			goto fee_0c08_1;
		}
		
		PHALCON_INIT_VAR(directory);
		ZVAL_ZVAL(directory, *hd, 1, 0);
		PHALCON_INIT_VAR(r10);
		PHALCON_CONCAT_VVS(r10, directory, class_name, ".php");
		PHALCON_CPY_WRT(path, r10);
		if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) {
			if (phalcon_require(path TSRMLS_CC) == FAILURE) {
				return;
			}
			PHALCON_MM_RESTORE();
			RETURN_TRUE;
		}
		zend_hash_move_forward_ex(ah1, &hp1);
		goto fes_0c08_1;
		fee_0c08_1:
		if(0){}
	} else {
		return;
	}
	
	PHALCON_MM_RESTORE();
}