本文整理汇总了C++中PHALCON_THROW_EXCEPTION_STR函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_THROW_EXCEPTION_STR函数的具体用法?C++ PHALCON_THROW_EXCEPTION_STR怎么用?C++ PHALCON_THROW_EXCEPTION_STR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_THROW_EXCEPTION_STR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Externally sets the view content
*
*<code>
*$this->view->setContent("<h1>hello</h1>");
*</code>
*
* @param string $content
*/
PHP_METHOD(Phalcon_Mvc_View, setContent){
zval *content;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &content) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(content) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_view_exception_ce, "Content must be a string");
return;
}
phalcon_update_property_zval(this_ptr, SL("_content"), content TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例2: PHP_METHOD
/**
* Sets the DependencyInjector container
*
* @param Phalcon\DI $dependencyInjector
*/
PHP_METHOD(Phalcon_Session_Bag, setDI){
zval *dependency_injector;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dependency_injector) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_session_exception_ce, "The dependency injector must be an Object");
return;
}
phalcon_update_property_zval(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例3: PHP_METHOD
/**
* Constructor for Phalcon\Db\Adapter\Pdo
*
* @param array $descriptor
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, __construct){
zval *descriptor;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &descriptor) == FAILURE) {
RETURN_MM_NULL();
}
if (Z_TYPE_P(descriptor) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "The descriptor must be an array");
return;
}
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "connect", descriptor);
PHALCON_CALL_PARENT_PARAMS_1_NORETURN(this_ptr, "Phalcon\\Db\\Adapter\\Pdo", "__construct", descriptor);
PHALCON_MM_RESTORE();
}
示例4: PHP_METHOD
/**
* Sets the dependency injector container.
*
* @param Phalcon\DI $dispatcher
*/
PHP_METHOD(Phalcon_Tag, setDI){
zval *dependency_injector = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dependency_injector) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_tag_exception_ce, "Parameter dependencyInjector must be an Object");
return;
}
phalcon_update_static_property(SL("phalcon\\tag"), SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例5: PHP_METHOD
/**
* Return active Dispatcher
*
* @return Phalcon_Dispatcher
*/
PHP_METHOD(Phalcon_Controller_Front, getDispatcher){
zval *t0 = NULL, *t1 = NULL;
PHALCON_MM_GROW();
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, "_dispatcher", sizeof("_dispatcher")-1, PHALCON_NOISY TSRMLS_CC);
if (zend_is_true(t0)) {
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_read_property(&t1, this_ptr, "_dispatcher", sizeof("_dispatcher")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_RETURN_CHECK_CTOR(t1);
} else {
PHALCON_THROW_EXCEPTION_STR(phalcon_exception_ce, "Dispatch process has not started yet");
return;
}
PHALCON_MM_RESTORE();
}
示例6: PHP_METHOD
/**
* Register an array of modules present in the console
*
*<code>
* $this->registerModules(array(
* 'frontend' => array(
* 'className' => 'Multiple\Frontend\Module',
* 'path' => '../apps/frontend/Module.php'
* ),
* 'backend' => array(
* 'className' => 'Multiple\Backend\Module',
* 'path' => '../apps/backend/Module.php'
* )
* ));
*</code>
*
* @param array $modules
*/
PHP_METHOD(Phalcon_CLI_Console, registerModules){
zval *modules;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &modules) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(modules) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_cli_console_exception_ce, "Modules must be an Array");
return;
}
phalcon_update_property_zval(this_ptr, SL("_modules"), modules TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例7: PHP_METHOD
/**
* Phalcon\Logger\Adapter\File constructor
*
* @param string $name
* @param array $options
*/
PHP_METHOD(Phalcon_Logger_Adapter_File, __construct){
zval *name, *options = NULL, *mode = NULL, *handler, *exception_message;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &name, &options);
if (!options) {
PHALCON_INIT_VAR(options);
}
if (phalcon_array_isset_string(options, SS("mode"))) {
PHALCON_OBS_VAR(mode);
phalcon_array_fetch_string(&mode, options, SL("mode"), PH_NOISY);
if (phalcon_memnstr_str(mode, SL("r"))) {
PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "Logger must be opened in append or write mode");
return;
}
} else {
PHALCON_INIT_NVAR(mode);
ZVAL_STRING(mode, "ab", 1);
}
/**
* We use 'fopen' to respect to open-basedir directive
*/
PHALCON_INIT_VAR(handler);
phalcon_call_func_p2(handler, "fopen", name, mode);
if (!zend_is_true(handler)) {
PHALCON_INIT_VAR(exception_message);
PHALCON_CONCAT_SVS(exception_message, "Can't open log file at '", name, "'");
PHALCON_THROW_EXCEPTION_ZVAL(phalcon_logger_exception_ce, exception_message);
return;
}
phalcon_update_property_this(this_ptr, SL("_path"), name TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_options"), options TSRMLS_CC);
phalcon_update_property_this(this_ptr, SL("_fileHandler"), handler TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例8: PHP_METHOD
/**
* 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();
}
示例9: PHP_METHOD
/**
* 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();
}
示例10: PHP_METHOD
/**
* Unserializing a resultset will allow to only works on the rows present in the saved state
*
* @param string $data
*/
PHP_METHOD(Phalcon_Mvc_Model_Resultset_Simple, unserialize){
zval *data, *resultset, *model, *rows, *cache, *column_map;
zval *hydrate_mode;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &data) == FAILURE) {
RETURN_MM_NULL();
}
phalcon_update_property_long(this_ptr, SL("_type"), 0 TSRMLS_CC);
PHALCON_INIT_VAR(resultset);
PHALCON_CALL_FUNC_PARAMS_1(resultset, "unserialize", data);
if (Z_TYPE_P(resultset) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Invalid serialization data");
return;
}
PHALCON_OBS_VAR(model);
phalcon_array_fetch_string(&model, resultset, SL("model"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_model"), model TSRMLS_CC);
PHALCON_OBS_VAR(rows);
phalcon_array_fetch_string(&rows, resultset, SL("rows"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_rows"), rows TSRMLS_CC);
PHALCON_OBS_VAR(cache);
phalcon_array_fetch_string(&cache, resultset, SL("cache"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_cache"), cache TSRMLS_CC);
PHALCON_OBS_VAR(column_map);
phalcon_array_fetch_string(&column_map, resultset, SL("columnMap"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_columnMap"), column_map TSRMLS_CC);
PHALCON_OBS_VAR(hydrate_mode);
phalcon_array_fetch_string(&hydrate_mode, resultset, SL("hydrateMode"), PH_NOISY_CC);
phalcon_update_property_zval(this_ptr, SL("_hydrateMode"), hydrate_mode TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例11: PHP_METHOD
/**
* Check if a model has certain attribute
*
* @param Phalcon\Mvc\ModelInterface $model
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, hasAttribute){
zval *model, *attribute, *column_map, *meta_data;
zval *data_types;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &model, &attribute) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(attribute) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Attribute must be a string");
return;
}
PHALCON_INIT_VAR(column_map);
PHALCON_CALL_METHOD_PARAMS_1(column_map, this_ptr, "getreversecolumnmap", model, PH_NO_CHECK);
if (Z_TYPE_P(column_map) == IS_ARRAY) {
eval_int = phalcon_array_isset(column_map, attribute);
if (eval_int) {
PHALCON_MM_RESTORE();
RETURN_TRUE;
}
} else {
PHALCON_INIT_VAR(meta_data);
PHALCON_CALL_METHOD_PARAMS_1(meta_data, this_ptr, "readmetadata", model, PH_NO_CHECK);
PHALCON_INIT_VAR(data_types);
phalcon_array_fetch_long(&data_types, meta_data, 4, PH_NOISY_CC);
eval_int = phalcon_array_isset(data_types, attribute);
if (eval_int) {
PHALCON_MM_RESTORE();
RETURN_TRUE;
}
}
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
示例12: PHP_METHOD
/**
* Phalcon_View_Engine_Mustache constructor
*
* @param Phalcon_View $view
* @param array $options
*/
PHP_METHOD(Phalcon_View_Engine_Mustache, __construct){
zval *view = NULL, *options = NULL, *mustache = NULL;
zval *c0 = NULL;
zval *r0 = NULL, *r1 = NULL;
zval *i0 = NULL;
int eval_int;
zend_class_entry *ce0;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &view, &options) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "Mustache", 1);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_FUNC_PARAMS_1(r0, "class_exists", c0);
if (!zend_is_true(r0)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_view_exception_ce, "Mustache class must be loaded first");
return;
}
eval_int = phalcon_array_isset_string(options, SL("mustache")+1);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r1);
phalcon_array_fetch_string(&r1, options, SL("mustache"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(mustache, r1);
} else {
ce0 = zend_fetch_class("Mustache", strlen("Mustache"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(i0);
object_init_ex(i0, ce0);
PHALCON_CALL_METHOD_NORETURN(i0, "__construct", PHALCON_CHECK);
PHALCON_CPY_WRT(mustache, i0);
}
phalcon_update_property_zval(this_ptr, SL("_mustache"), mustache TSRMLS_CC);
PHALCON_CALL_PARENT_PARAMS_2_NORETURN(this_ptr, "Phalcon_View_Engine_Mustache", "__construct", view, options);
PHALCON_MM_RESTORE();
}
示例13: PHP_METHOD
/**
* Rollbacks the internal transaction
*
*/
PHP_METHOD(Phalcon_Logger_Adapter_File, rollback){
zval *transaction = NULL, *quenue = NULL;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(transaction);
phalcon_read_property(&transaction, this_ptr, SL("_transaction"), PH_NOISY_CC);
if (!zend_is_true(transaction)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_logger_exception_ce, "There is no active transaction");
return;
}
phalcon_update_property_bool(this_ptr, SL("_transaction"), 0 TSRMLS_CC);
PHALCON_INIT_VAR(quenue);
array_init(quenue);
phalcon_update_property_zval(this_ptr, SL("_quenue"), quenue TSRMLS_CC);
PHALCON_MM_RESTORE();
}
示例14: PHP_METHOD
/**
* Sets a database profiler to the connection
*
* @param Phalcon_Db_Profiler $profiler
*/
PHP_METHOD(Phalcon_Db, setProfiler){
zval *profiler = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &profiler) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(profiler) == IS_OBJECT) {
phalcon_update_property_zval(this_ptr, "_profiler", strlen("_profiler"), profiler TSRMLS_CC);
} else {
PHALCON_THROW_EXCEPTION_STR(phalcon_db_exception_ce, "Profiler must be an object");
return;
}
PHALCON_MM_RESTORE();
}
示例15: PHP_METHOD
/**
* Set an array with CSS classes to format the messages
*
* @param array $cssClasses
*/
PHP_METHOD(Phalcon_Flash, setCssClasses){
zval *css_classes = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &css_classes) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(css_classes) == IS_ARRAY) {
phalcon_update_property_zval(this_ptr, SL("_cssClasses"), css_classes TSRMLS_CC);
} else {
PHALCON_THROW_EXCEPTION_STR(phalcon_flash_exception_ce, "CSS classes must be an Array");
return;
}
RETURN_CCTOR(this_ptr);
}