本文整理汇总了C++中phalcon_get_class函数的典型用法代码示例。如果您正苦于以下问题:C++ phalcon_get_class函数的具体用法?C++ phalcon_get_class怎么用?C++ phalcon_get_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phalcon_get_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Checks if a model is using implicit object ids
*
* @param Phalcon\Mvc\CollectionInterface $model
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Collection_Manager, isUsingImplicitObjectIds){
zval *model, *entity_name, *implicit_objects_ids;
zval *implicit;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &model);
if (Z_TYPE_P(model) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_collection_exception_ce, "A valid collection instance is required");
return;
}
PHALCON_INIT_VAR(entity_name);
phalcon_get_class(entity_name, model, 1 TSRMLS_CC);
/**
* All collections use by default are using implicit object ids
*/
PHALCON_OBS_VAR(implicit_objects_ids);
phalcon_read_property_this(&implicit_objects_ids, this_ptr, SL("_implicitObjectsIds"), PH_NOISY_CC);
if (phalcon_array_isset(implicit_objects_ids, entity_name)) {
PHALCON_OBS_VAR(implicit);
phalcon_array_fetch(&implicit, implicit_objects_ids, entity_name, PH_NOISY_CC);
RETURN_CCTOR(implicit);
}
RETURN_MM_TRUE;
}
开发者ID:101010111100,项目名称:cphalcon,代码行数:36,代码来源:manager.c
示例2: PHP_METHOD
/**
* Gets hasMany relations defined on a model
*
* @param Phalcon\Mvc\Model $model
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasMany){
zval *model, *model_name, *has_many, *relations;
zval *empty_array;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &model) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(model_name);
phalcon_get_class(model_name, model TSRMLS_CC);
PHALCON_INIT_VAR(has_many);
phalcon_read_property(&has_many, this_ptr, SL("_hasMany"), PH_NOISY_CC);
eval_int = phalcon_array_isset(has_many, model_name);
if (eval_int) {
PHALCON_INIT_VAR(relations);
phalcon_array_fetch(&relations, has_many, model_name, PH_NOISY_CC);
RETURN_CCTOR(relations);
}
PHALCON_INIT_VAR(empty_array);
array_init(empty_array);
RETURN_CTOR(empty_array);
}
开发者ID:alantonilopez,项目名称:cphalcon,代码行数:37,代码来源:manager.c
示例3: PHP_METHOD
/**
* Gets hasOne relations defined on a model
*
* @param Phalcon\Mvc\Model $model
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasOne){
zval *model = NULL, *model_name = NULL, *has_one = NULL, *empty_array = NULL;
zval *r0 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &model) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(model_name);
phalcon_get_class(model_name, model TSRMLS_CC);
PHALCON_INIT_VAR(has_one);
phalcon_read_property(&has_one, this_ptr, SL("_hasOne"), PH_NOISY_CC);
eval_int = phalcon_array_isset(has_one, model_name);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r0);
phalcon_array_fetch(&r0, has_one, model_name, PH_NOISY_CC);
RETURN_CCTOR(r0);
}
PHALCON_INIT_VAR(empty_array);
array_init(empty_array);
RETURN_CTOR(empty_array);
}
开发者ID:digitalhydra,项目名称:cphalcon,代码行数:37,代码来源:manager.c
示例4: PHP_METHOD
/**
* Reads the ordered/reversed column map for certain model
*
*<code>
* print_r($metaData->readColumnMap(new Robots()));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMap){
zval *model, *key_name, *column_map = NULL, *null_value;
zval *data;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &model);
PHALCON_VERIFY_INTERFACE_EX(model, phalcon_mvc_modelinterface_ce, phalcon_mvc_model_exception_ce, 1);
if (!PHALCON_GLOBAL(orm).column_renaming) {
RETURN_MM();
}
PHALCON_INIT_VAR(key_name);
phalcon_get_class(key_name, model, 1 TSRMLS_CC);
PHALCON_OBS_VAR(column_map);
phalcon_read_property_this(&column_map, this_ptr, SL("_columnMap"), PH_NOISY TSRMLS_CC);
if (!phalcon_array_isset(column_map, key_name)) {
null_value = PHALCON_GLOBAL(z_null);
PHALCON_CALL_METHOD(NULL, this_ptr, "_initialize", model, null_value, null_value, null_value);
PHALCON_OBS_NVAR(column_map);
phalcon_read_property_this(&column_map, this_ptr, SL("_columnMap"), PH_NOISY TSRMLS_CC);
}
PHALCON_OBS_VAR(data);
phalcon_array_fetch(&data, column_map, key_name, PH_NOISY);
RETURN_CTOR(data);
}
开发者ID:100851766,项目名称:cphalcon,代码行数:42,代码来源:metadata.c
示例5: PHP_METHOD
/**
* Reads the ordered/reversed column map for certain model
*
*<code>
* print_r($metaData->readColumnMap(new Robots()));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMap) {
zval *model, *key_name, *column_map = NULL, *null_value;
zval *data;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &model);
if (Z_TYPE_P(model) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "A model instance is required to retrieve the meta-data");
return;
}
PHALCON_INIT_VAR(key_name);
phalcon_get_class(key_name, model, 1 TSRMLS_CC);
PHALCON_OBS_VAR(column_map);
phalcon_read_property_this(&column_map, this_ptr, SL("_columnMap"), PH_NOISY_CC);
if (!phalcon_array_isset(column_map, key_name)) {
PHALCON_INIT_VAR(null_value);
phalcon_call_method_p4_noret(this_ptr, "_initialize", model, null_value, null_value, null_value);
PHALCON_OBS_NVAR(column_map);
phalcon_read_property_this(&column_map, this_ptr, SL("_columnMap"), PH_NOISY_CC);
}
PHALCON_OBS_VAR(data);
phalcon_array_fetch(&data, column_map, key_name, PH_NOISY);
RETURN_CCTOR(data);
}
开发者ID:rakeshbitling,项目名称:cphalcon,代码行数:42,代码来源:metadata.c
示例6: PHP_METHOD
/**
* Reads meta-data for certain model using a MODEL_* constant
*
*<code>
* print_r($metaData->writeColumnMapIndex(new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP, array('leName' => 'name')));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @param int $index
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaDataIndex){
zval *model, *index, *table, *schema, *class_name;
zval *key, *meta_data = NULL, *meta_data_index, *attributes;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &model, &index) == FAILURE) {
RETURN_MM_NULL();
}
if (Z_TYPE_P(model) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "A model instance is required to retrieve the meta-data");
return;
}
if (Z_TYPE_P(index) != IS_LONG) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Index must be a valid integer constant");
return;
}
PHALCON_INIT_VAR(table);
PHALCON_CALL_METHOD(table, model, "getsource");
PHALCON_INIT_VAR(schema);
PHALCON_CALL_METHOD(schema, model, "getschema");
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, model, 1 TSRMLS_CC);
/**
* Unique key for meta-data is created using class-name-schema-table
*/
PHALCON_INIT_VAR(key);
PHALCON_CONCAT_VSVV(key, class_name, "-", schema, table);
PHALCON_OBS_VAR(meta_data);
phalcon_read_property(&meta_data, this_ptr, SL("_metaData"), PH_NOISY_CC);
if (!phalcon_array_isset(meta_data, key)) {
PHALCON_CALL_METHOD_PARAMS_4_NORETURN(this_ptr, "_initialize", model, key, table, schema);
PHALCON_OBS_NVAR(meta_data);
phalcon_read_property(&meta_data, this_ptr, SL("_metaData"), PH_NOISY_CC);
}
PHALCON_OBS_VAR(meta_data_index);
phalcon_array_fetch(&meta_data_index, meta_data, key, PH_NOISY_CC);
PHALCON_OBS_VAR(attributes);
phalcon_array_fetch(&attributes, meta_data_index, index, PH_NOISY_CC);
RETURN_CCTOR(attributes);
}
开发者ID:BlueShark,项目名称:cphalcon,代码行数:63,代码来源:metadata.c
示例7: PHP_METHOD
/**
* Appends a message to the validator
*
* @param string $message
* @param string $field
* @param string $type
*/
PHP_METHOD(Phalcon_Mvc_Model_Validator, appendMessage){
zval *message = NULL, *field = NULL, *type = NULL, *class_name = NULL, *suffix = NULL;
zval *empty_string = NULL, *model_message = NULL;
zval *t0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|zz", &message, &field, &type) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!field) {
PHALCON_ALLOC_ZVAL_MM(field);
ZVAL_NULL(field);
}
if (!type) {
PHALCON_ALLOC_ZVAL_MM(type);
ZVAL_NULL(type);
} else {
PHALCON_SEPARATE_PARAM(type);
}
if (!zend_is_true(type)) {
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, this_ptr TSRMLS_CC);
PHALCON_INIT_VAR(suffix);
ZVAL_STRING(suffix, "Validator", 1);
PHALCON_INIT_VAR(empty_string);
ZVAL_STRING(empty_string, "", 1);
PHALCON_INIT_VAR(type);
phalcon_fast_str_replace(type, suffix, empty_string, class_name TSRMLS_CC);
}
PHALCON_INIT_VAR(model_message);
object_init_ex(model_message, phalcon_mvc_model_message_ce);
PHALCON_CALL_METHOD_PARAMS_3_NORETURN(model_message, "__construct", message, field, type, PH_CHECK);
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_messages"), PH_NOISY_CC);
phalcon_array_append(&t0, model_message, 0 TSRMLS_CC);
phalcon_update_property_zval(this_ptr, SL("_messages"), t0 TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:meibk,项目名称:cphalcon,代码行数:57,代码来源:validator.c
示例8: PHP_METHOD
/**
* Sets a custom events manager for a specific model
*
* @param Phalcon\Mvc\CollectionInterface $model
* @param Phalcon\Events\ManagerInterface $eventsManager
*/
PHP_METHOD(Phalcon_Mvc_Collection_Manager, setCustomEventsManager){
zval *model, *events_manager, *class_name;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 2, 0, &model, &events_manager);
PHALCON_VERIFY_INTERFACE_EX(model, phalcon_mvc_collectioninterface_ce, phalcon_mvc_collection_exception_ce, 1);
PHALCON_VERIFY_INTERFACE_OR_NULL_EX(events_manager, phalcon_events_managerinterface_ce, phalcon_mvc_collection_exception_ce, 1);
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, model, 1 TSRMLS_CC);
phalcon_update_property_array(this_ptr, SL("_customEventsManager"), class_name, events_manager TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:100851766,项目名称:cphalcon,代码行数:22,代码来源:manager.c
示例9: PHP_METHOD
/**
* Reads column-map information for certain model using a MODEL_* constant
*
* @param Phalcon\Mvc\ModelInterface $model
* @param int $index
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, readColumnMapIndex){
zval *model, *index, *class_name, *column_map = NULL, *null_value;
zval *attributes;
zval *r0 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &model, &index) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (Z_TYPE_P(model) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "A model instance is required to retrieve the meta-data");
return;
}
if (Z_TYPE_P(index) != IS_LONG) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Index must be a valid integer constant");
return;
}
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, model TSRMLS_CC);
PHALCON_INIT_VAR(column_map);
phalcon_read_property(&column_map, this_ptr, SL("_columnMap"), PH_NOISY_CC);
eval_int = phalcon_array_isset(column_map, class_name);
if (!eval_int) {
PHALCON_INIT_VAR(null_value);
PHALCON_CALL_METHOD_PARAMS_4_NORETURN(this_ptr, "_initialize", model, null_value, null_value, null_value, PH_NO_CHECK);
PHALCON_INIT_NVAR(column_map);
phalcon_read_property(&column_map, this_ptr, SL("_columnMap"), PH_NOISY_CC);
}
PHALCON_INIT_VAR(r0);
phalcon_array_fetch(&r0, column_map, class_name, PH_NOISY_CC);
PHALCON_INIT_VAR(attributes);
phalcon_array_fetch(&attributes, r0, index, PH_NOISY_CC);
RETURN_CCTOR(attributes);
}
开发者ID:Tigerlee1987,项目名称:cphalcon,代码行数:51,代码来源:metadata.c
示例10: PHP_METHOD
/**
* Adds a user-defined method
*
* @param string $name
* @param closure $methodCallable
* @return Phalcon\Mvc\View\Engine
*/
PHP_METHOD(Phalcon_Mvc_View_Engine, addMethod){
zval *name, *method_callable, class_name = {}, method = {};
phalcon_fetch_params(0, 2, 0, &name, &method_callable);
PHALCON_ENSURE_IS_STRING(name);
if (Z_TYPE_P(method_callable) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(method_callable), zend_ce_closure)) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_view_exception_ce, "Method must be an closure object");
return;
}
phalcon_get_class(&class_name, getThis(), 0);
PHALCON_CALL_CE_STATICW(&method, zend_ce_closure, "bind", method_callable, getThis(), &class_name);
phalcon_update_property_array(getThis(), SL("_methods"), name, &method);
RETURN_THISW();
}
开发者ID:googlle,项目名称:cphalcon7,代码行数:26,代码来源:engine.c
示例11: PHP_METHOD
/**
* Reads meta-data for certain model using a MODEL_* constant
*
*<code>
* print_r($metaData->writeColumnMapIndex(new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP, array('leName' => 'name')));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @param int $index
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaDataIndex){
zval **model, **index, *table = NULL, *schema = NULL, *class_name;
zval *key, *meta_data = NULL, *meta_data_index, *attributes;
phalcon_fetch_params_ex(2, 0, &model, &index);
PHALCON_VERIFY_INTERFACE_EX(*model, phalcon_mvc_modelinterface_ce, phalcon_mvc_model_exception_ce, 0);
PHALCON_ENSURE_IS_LONG(index);
PHALCON_MM_GROW();
PHALCON_CALL_METHOD(&table, *model, "getsource");
PHALCON_CALL_METHOD(&schema, *model, "getschema");
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, *model, 1 TSRMLS_CC);
/**
* Unique key for meta-data is created using class-name-schema-table
*/
PHALCON_INIT_VAR(key);
PHALCON_CONCAT_VSVV(key, class_name, "-", schema, table);
PHALCON_OBS_VAR(meta_data);
phalcon_read_property_this(&meta_data, this_ptr, SL("_metaData"), PH_NOISY TSRMLS_CC);
if (!phalcon_array_isset(meta_data, key)) {
PHALCON_CALL_METHOD(NULL, this_ptr, "_initialize", *model, key, table, schema);
PHALCON_OBS_NVAR(meta_data);
phalcon_read_property_this(&meta_data, this_ptr, SL("_metaData"), PH_NOISY TSRMLS_CC);
}
PHALCON_OBS_VAR(meta_data_index);
phalcon_array_fetch(&meta_data_index, meta_data, key, PH_NOISY);
PHALCON_OBS_VAR(attributes);
phalcon_array_fetch(&attributes, meta_data_index, *index, PH_NOISY);
RETURN_CTOR(attributes);
}
开发者ID:tianhendi,项目名称:cphalcon,代码行数:53,代码来源:metadata.c
示例12: PHP_METHOD
/**
* Appends a message to the validator
*
* @param string $message
* @param string $field
* @param string $type
*/
PHP_METHOD(Phalcon_Mvc_Model_Validator, appendMessage){
zval *message, *field = NULL, *type = NULL, *class_name, *suffix;
zval *empty_string, *model_message;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 2, &message, &field, &type);
if (!field) {
PHALCON_INIT_VAR(field);
}
if (!type) {
PHALCON_INIT_VAR(type);
} else {
PHALCON_SEPARATE_PARAM(type);
}
if (!zend_is_true(type)) {
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, this_ptr, 0 TSRMLS_CC);
PHALCON_INIT_VAR(suffix);
ZVAL_STRING(suffix, "Validator", 1);
PHALCON_INIT_VAR(empty_string);
ZVAL_STRING(empty_string, "", 1);
PHALCON_INIT_NVAR(type);
phalcon_fast_str_replace(type, suffix, empty_string, class_name TSRMLS_CC);
}
PHALCON_INIT_VAR(model_message);
object_init_ex(model_message, phalcon_mvc_model_message_ce);
phalcon_call_method_p3_noret(model_message, "__construct", message, field, type);
phalcon_update_property_array_append(this_ptr, SL("_messages"), model_message TSRMLS_CC);
PHALCON_MM_RESTORE();
}
开发者ID:RSivakov,项目名称:cphalcon,代码行数:48,代码来源:validator.c
示例13: PHP_METHOD
/**
* Magic method __get
*
* @param string $propertyName
*/
PHP_METHOD(Phalcon_Controller, __get){
zval *property_name = NULL, *model = NULL;
zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *r4 = NULL;
zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL;
zval *i0 = NULL, *i1 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &property_name) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (PHALCON_COMPARE_STRING(property_name, "view")) {
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_METHOD(r0, this_ptr, "_getviewcomponent", PHALCON_NO_CHECK);
phalcon_update_property_zval(this_ptr, "view", strlen("view"), r0 TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, "view", sizeof("view")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_RETURN_CHECK_CTOR(t0);
}
if (PHALCON_COMPARE_STRING(property_name, "filter")) {
PHALCON_ALLOC_ZVAL_MM(i0);
object_init_ex(i0, phalcon_filter_ce);
PHALCON_CALL_METHOD_NORETURN(i0, "__construct", PHALCON_CHECK);
phalcon_update_property_zval(this_ptr, "filter", strlen("filter"), i0 TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_read_property(&t1, this_ptr, "filter", sizeof("filter")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_RETURN_CHECK_CTOR(t1);
}
if (PHALCON_COMPARE_STRING(property_name, "session")) {
PHALCON_ALLOC_ZVAL_MM(i1);
object_init_ex(i1, phalcon_session_namespace_ce);
PHALCON_ALLOC_ZVAL_MM(r1);
phalcon_get_class(r1, this_ptr TSRMLS_CC);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i1, "__construct", r1, PHALCON_CHECK);
phalcon_update_property_zval(this_ptr, "session", strlen("session"), i1 TSRMLS_CC);
PHALCON_ALLOC_ZVAL_MM(t2);
phalcon_read_property(&t2, this_ptr, "session", sizeof("session")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_RETURN_CHECK_CTOR(t2);
}
PHALCON_ALLOC_ZVAL_MM(t3);
phalcon_read_property(&t3, this_ptr, "model", sizeof("model")-1, PHALCON_NOISY TSRMLS_CC);
if (zend_is_true(t3)) {
PHALCON_ALLOC_ZVAL_MM(t4);
phalcon_read_property(&t4, this_ptr, "model", sizeof("model")-1, PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(model, t4);
PHALCON_ALLOC_ZVAL_MM(r2);
PHALCON_CALL_METHOD_PARAMS_1(r2, model, "ismodel", property_name, PHALCON_NO_CHECK);
if (zend_is_true(r2)) {
PHALCON_ALLOC_ZVAL_MM(r3);
PHALCON_CALL_METHOD_PARAMS_1(r3, model, "getmodel", property_name, PHALCON_NO_CHECK);
PHALCON_RETURN_DZVAL(r3);
}
}
PHALCON_ALLOC_ZVAL_MM(r4);
PHALCON_CONCAT_LEFT(r4, "Access to undefined property ", property_name);
PHALCON_CALL_FUNC_PARAMS_1_NORETURN("trigger_error", r4, 0x033);
PHALCON_MM_RESTORE();
RETURN_NULL();
}
开发者ID:loudertech,项目名称:cphalcon,代码行数:77,代码来源:controller.c
示例14: PHP_METHOD
/**
* Initialize the metadata for certain table
*
* @param Phalcon\Mvc\Model $model
* @param string $key
* @param string $table
* @param string $schema
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, _initializeMetaData){
zval *model, *key, *table, *schema, *meta_data, *data;
zval *table_metadata = NULL, *class_name = NULL, *exception_message = NULL;
zval *connection, *exists, *complete_table = NULL, *attributes;
zval *primary_keys, *non_primary_keys, *numeric_typed;
zval *not_null, *field_types, *field_bind_types;
zval *automatic_default, *identity_field = NULL;
zval *columns, *column = NULL, *field_name = NULL, *feature = NULL, *type = NULL;
zval *bind_type = NULL;
zval *t0 = NULL;
HashTable *ah0;
HashPosition hp0;
zval **hd;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzzz", &model, &key, &table, &schema) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(meta_data);
phalcon_read_property(&meta_data, this_ptr, SL("_metaData"), PH_NOISY_CC);
eval_int = phalcon_array_isset(meta_data, key);
if (!eval_int) {
PHALCON_INIT_VAR(data);
PHALCON_CALL_METHOD_PARAMS_1(data, this_ptr, "read", key, PH_NO_CHECK);
if (Z_TYPE_P(data) != IS_NULL) {
phalcon_array_update_zval(&meta_data, key, &data, PH_COPY | PH_SEPARATE TSRMLS_CC);
phalcon_update_property_zval(this_ptr, SL("_metaData"), meta_data TSRMLS_CC);
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (phalcon_method_exists_ex(model, SS("metadata") TSRMLS_CC) == SUCCESS) {
PHALCON_INIT_VAR(table_metadata);
PHALCON_CALL_METHOD(table_metadata, model, "metadata", PH_NO_CHECK);
if (Z_TYPE_P(table_metadata) != IS_ARRAY) {
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, model TSRMLS_CC);
PHALCON_INIT_VAR(exception_message);
PHALCON_CONCAT_SV(exception_message, "Invalid meta-data for model ", class_name);
PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message);
return;
}
} else {
PHALCON_INIT_VAR(connection);
PHALCON_CALL_METHOD(connection, model, "getconnection", PH_NO_CHECK);
PHALCON_INIT_VAR(exists);
PHALCON_CALL_METHOD_PARAMS_2(exists, connection, "tableexists", table, schema, PH_NO_CHECK);
if (!zend_is_true(exists)) {
if (zend_is_true(schema)) {
PHALCON_INIT_VAR(complete_table);
PHALCON_CONCAT_VSV(complete_table, schema, "\".\"", table);
} else {
PHALCON_CPY_WRT(complete_table, table);
}
PHALCON_INIT_NVAR(class_name);
phalcon_get_class(class_name, model TSRMLS_CC);
PHALCON_INIT_NVAR(exception_message);
PHALCON_CONCAT_SVSV(exception_message, "Table \"", complete_table, "\" doesn't exist on database when dumping meta-data for ", class_name);
PHALCON_THROW_EXCEPTION_ZVAL(phalcon_mvc_model_exception_ce, exception_message);
return;
}
PHALCON_INIT_VAR(attributes);
array_init(attributes);
PHALCON_INIT_VAR(primary_keys);
array_init(primary_keys);
PHALCON_INIT_VAR(non_primary_keys);
array_init(non_primary_keys);
PHALCON_INIT_VAR(numeric_typed);
array_init(numeric_typed);
PHALCON_INIT_VAR(not_null);
array_init(not_null);
PHALCON_INIT_VAR(field_types);
array_init(field_types);
PHALCON_INIT_VAR(field_bind_types);
array_init(field_bind_types);
//.........这里部分代码省略.........
开发者ID:alantonilopez,项目名称:cphalcon,代码行数:101,代码来源:metadata.c
示例15: PHP_METHOD
/**
* Handles uncaught exceptions
*
* @param \Exception $exception
* @return boolean
*/
PHP_METHOD(Phalcon_Debug, onUncaughtException){
zval *exception, *is_active = NULL, *message = NULL;
zval *class_name, *css_sources, *escaped_message = NULL;
zval *html, *version, *file, *line, *show_back_trace;
zval *data_vars, *trace, *trace_item = NULL, *n = NULL, *html_item = NULL;
zval *_REQUEST, *value = NULL, *key_request = NULL, *_SERVER;
zval *key_server = NULL, *files, *key_file = NULL;
zval *memory, *data_var = NULL, *key_var = NULL, *variable = NULL, *dumped_argument = NULL;
zval *js_sources;
HashTable *ah0, *ah1, *ah2, *ah3, *ah4;
HashPosition hp0, hp1, hp2, hp3, hp4;
zval **hd;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &exception);
/**
* Cancel the output buffer if active
*/
if (phalcon_ob_get_level(TSRMLS_C) > 0) {
phalcon_ob_end_clean(TSRMLS_C);
}
PHALCON_OBS_VAR(is_active);
phalcon_read_static_property(&is_active, SL("phalcon\\debug"), SL("_isActive") TSRMLS_CC);
/**
* Avoid that multiple exceptions being showed
*/
if (zend_is_true(is_active)) {
PHALCON_INIT_VAR(message);
phalcon_call_method(message, exception, "getmessage");
zend_print_zval(message, 0);
}
PHALCON_INIT_NVAR(is_active);
ZVAL_BOOL(is_active, 1);
/**
* Globally block the debug component to avoid other exceptions must be shown
*/
phalcon_update_static_property(SL("phalcon\\debug"), SL("_isActive"), is_active TSRMLS_CC);
PHALCON_INIT_VAR(class_name);
phalcon_get_class(class_name, exception, 0 TSRMLS_CC);
PHALCON_INIT_NVAR(message);
phalcon_call_method(message, exception, "getmessage");
/**
* CSS static sources to style the error presentation
*/
PHALCON_INIT_VAR(css_sources);
phalcon_call_method(css_sources, this_ptr, "getcsssources");
/**
* Escape the exception's message avoiding possible XSS injections?
*/
PHALCON_CPY_WRT(escaped_message, message);
/**
* Use the exception info as document's title
*/
PHALCON_INIT_VAR(html);
PHALCON_CONCAT_SVSVS(html, "<html><head><title>", class_name, ": ", escaped_message, "</title>");
PHALCON_SCONCAT_VS(html, css_sources, "</head><body>");
/**
* Get the version link
*/
PHALCON_INIT_VAR(version);
phalcon_call_method(version, this_ptr, "getversion");
phalcon_concat_self(&html, version TSRMLS_CC);
PHALCON_INIT_VAR(file);
phalcon_call_method(file, exception, "getfile");
PHALCON_INIT_VAR(line);
phalcon_call_method(line, exception, "getline");
/**
* Main exception info
*/
phalcon_concat_self_str(&html, SL("<div align=\"center\"><div class=\"error-main\">") TSRMLS_CC);
PHALCON_SCONCAT_SVSVS(html, "<h1>", class_name, ": ", escaped_message, "</h1>");
PHALCON_SCONCAT_SVSVS(html, "<span class=\"error-file\">", file, " (", line, ")</span>");
phalcon_concat_self_str(&html, SL("</div>") TSRMLS_CC);
PHALCON_OBS_VAR(show_back_trace);
phalcon_read_property_this(&show_back_trace, this_ptr, SL("_showBackTrace"), PH_NOISY_CC);
/**
//.........这里部分代码省略.........
开发者ID:Dinesh-Ramakrishnan,项目名称:cphalcon,代码行数:101,代码来源:debug.c
注:本文中的phalcon_get_class函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论