本文整理汇总了C++中PHALCON_CALL_METHODW函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_CALL_METHODW函数的具体用法?C++ PHALCON_CALL_METHODW怎么用?C++ PHALCON_CALL_METHODW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_CALL_METHODW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Returns a cached content
*
* @param int|string $keyName
* @param long $lifetime
* @return mixed
*/
PHP_METHOD(Phalcon_Cache_Backend_Memcache, get){
zval *key_name, *lifetime = NULL, memcache = {}, frontend = {}, prefix = {}, prefixed_key = {}, cached_content = {};
phalcon_fetch_params(0, 1, 1, &key_name, &lifetime);
phalcon_return_property(&memcache, getThis(), SL("_memcache"));
if (Z_TYPE(memcache) != IS_OBJECT) {
PHALCON_CALL_METHODW(&memcache, getThis(), "_connect");
}
phalcon_return_property(&frontend, getThis(), SL("_frontend"));
phalcon_return_property(&prefix, getThis(), SL("_prefix"));
PHALCON_CONCAT_VV(&prefixed_key, &prefix, key_name);
phalcon_update_property_zval(getThis(), SL("_lastKey"), &prefixed_key);
PHALCON_CALL_METHODW(&cached_content, &memcache, "get", &prefixed_key);
if (PHALCON_IS_FALSE(&cached_content)) {
RETURN_NULL();
}
if (phalcon_is_numeric(&cached_content)) {
RETURN_CTORW(&cached_content);
}
PHALCON_RETURN_CALL_METHOD(&frontend, "afterretrieve", &cached_content);
}
示例2: PHP_METHOD
/**
* Gets the column name in MySQL
*
* @param Phalcon\Db\ColumnInterface $column
* @return string
*/
PHP_METHOD(Phalcon_Db_Dialect_Mysql, getColumnDefinition){
zval *column, size = {}, column_type = {}, column_sql = {}, type_values = {}, slash = {}, *value, value_cslashes = {}, is_unsigned = {}, scale = {}, name = {};
int c, i = 0;
phalcon_fetch_params(0, 1, 0, &column);
PHALCON_VERIFY_INTERFACE_EX(column, phalcon_db_columninterface_ce, phalcon_db_exception_ce, 0);
PHALCON_CALL_METHODW(&size, column, "getsize");
PHALCON_CALL_METHODW(&column_type, column, "gettype");
if (Z_TYPE(column_type) == IS_STRING) {
PHALCON_CPY_WRT(&column_sql, &column_type);
PHALCON_CALL_METHODW(&type_values, column, "gettypevalues");
if (PHALCON_IS_NOT_EMPTY(&type_values)) {
ZVAL_STRING(&slash, "\"");
if (Z_TYPE(type_values) == IS_ARRAY) {
c = phalcon_fast_count_int(&type_values);
phalcon_concat_self_str(&column_sql, SL("("));
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(type_values), value) {
i++;
PHALCON_CALL_FUNCTIONW(&value_cslashes, "addcslashes", value, &slash);
if (i < c) {
PHALCON_SCONCAT_SVS(&column_sql, "\"", &value_cslashes, "\", ");
} else {
PHALCON_SCONCAT_SVS(&column_sql, "\"", &value_cslashes, "\"");
}
} ZEND_HASH_FOREACH_END();
示例3: PHP_METHOD
/**
* Create a new Query Builder for Delete
*
*
* @return Phalcon\Mvc\Model\Query\Builder\Delete
*/
PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, createDeleteBuilder){
zval *params = NULL, *_di = NULL, di = {}, service_name = {};
phalcon_fetch_params(0, 0, 2, ¶ms, &_di);
if (!params) {
params = &PHALCON_GLOBAL(z_null);
}
if (!_di) {
_di = &PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(_di) == IS_OBJECT) {
PHALCON_VERIFY_INTERFACEW(_di, phalcon_diinterface_ce);
PHALCON_CPY_WRT(&di, _di);
} else {
PHALCON_CALL_CE_STATICW(&di, phalcon_di_ce, "getdefault", _di);
}
PHALCON_STR(&service_name, ISV(modelsQueryBuilderForDelete));
PHALCON_CALL_METHODW(return_value, &di, "get", &service_name, &PHALCON_GLOBAL(z_null), &PHALCON_GLOBAL(z_true));
if (Z_TYPE_P(return_value) != IS_OBJECT) {
object_init_ex(return_value, phalcon_mvc_model_query_builder_delete_ce);
PHALCON_CALL_METHODW(NULL, return_value, "__construct", params);
}
PHALCON_VERIFY_INTERFACEW(return_value, phalcon_mvc_model_query_builderinterface_ce);
}
示例4: PHP_METHOD
/**
* Checks whether put has certain index
*
* @param string $name
* @return boolean
*/
PHP_METHOD(Phalcon_Http_Request, hasPut)
{
zval *name, is_put = {}, put = {}, raw = {}, new_put = {};
char *tmp;
phalcon_fetch_params(0, 1, 0, &name);
PHALCON_CALL_METHODW(&is_put, getThis(), "isput");
if (!zend_is_true(&is_put)) {
phalcon_read_global_str(&new_put, SL("_PUT"));
} else {
phalcon_read_property(&put, getThis(), SL("_put"), PH_NOISY);
if (Z_TYPE(put) != IS_ARRAY) {
PHALCON_CALL_METHODW(&raw, getThis(), "getrawbody");
array_init(&new_put);
PHALCON_ENSURE_IS_STRING(&raw);
tmp = estrndup(Z_STRVAL(raw), Z_STRLEN(raw));
sapi_module.treat_data(PARSE_STRING, tmp, &new_put);
phalcon_update_property_zval(getThis(), SL("_put"), &new_put);
} else {
PHALCON_CPY_WRT(&new_put, &put);
}
}
RETVAL_BOOL(phalcon_array_isset(&new_put, name));
}
示例5: PHP_METHOD
/**
* Starts the profile of a SQL sentence
*
* @param string $sqlStatement
* @param $sqlVariables
* @param $sqlBindTypes
* @return Phalcon\Db\Profiler
*/
PHP_METHOD(Phalcon_Db_Profiler, startProfile){
zval *sql_statement, *sql_variables = NULL, *sql_bindtypes = NULL, active_profile = {}, time = {};
phalcon_fetch_params(0, 1, 2, &sql_statement, &sql_variables, &sql_bindtypes);
object_init_ex(&active_profile, phalcon_db_profiler_item_ce);
PHALCON_CALL_METHODW(NULL, &active_profile, "setsqlstatement", sql_statement);
if (sql_variables) {
PHALCON_CALL_METHODW(NULL, &active_profile, "setsqlvariables", sql_variables);
}
if (sql_bindtypes) {
PHALCON_CALL_METHODW(NULL, &active_profile, "setsqlbindtypes", sql_bindtypes);
}
PHALCON_CALL_FUNCTIONW(&time, "microtime", &PHALCON_GLOBAL(z_true));
PHALCON_CALL_METHODW(NULL, &active_profile, "setinitialtime", &time);
if (phalcon_method_exists_ex(getThis(), SL("beforestartprofile")) == SUCCESS) {
PHALCON_CALL_METHODW(NULL, getThis(), "beforestartprofile", &active_profile);
}
phalcon_update_property_zval(getThis(), SL("_activeProfile"), &active_profile);
RETURN_THISW();
}
示例6: PHP_METHOD
/**
* Phalcon\Mvc\Model\Transaction constructor
*
* @param Phalcon\DIInterface $dependencyInjector
* @param boolean $autoBegin
* @param string $service
*/
PHP_METHOD(Phalcon_Mvc_Model_Transaction, __construct){
zval *dependency_injector, *auto_begin = NULL, *s = NULL, service = {}, connection = {};
phalcon_fetch_params(0, 1, 2, &dependency_injector, &auto_begin, &service);
if (!auto_begin) {
auto_begin = &PHALCON_GLOBAL(z_false);
}
if (!s || Z_TYPE_P(s) != IS_STRING) {
ZVAL_STRING(&service, "db");
} else {
PHALCON_CPY_WRT(&service, s);
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_transaction_exception_ce, "A dependency injector container is required to obtain the services related to the ORM");
return;
}
PHALCON_CALL_METHODW(&connection, dependency_injector, "get", &service);
phalcon_update_property_zval(getThis(), SL("_connection"), &connection);
if (zend_is_true(auto_begin)) {
PHALCON_CALL_METHODW(NULL, &connection, "begin");
}
}
示例7: PHP_METHOD
/**
* Executes the validation
*
* @param Phalcon\Validation $validator
* @param string $attribute
* @return boolean
*/
PHP_METHOD(Phalcon_Validation_Validator_Between, validate){
zval *validator, *attribute, value = {}, allow_empty = {}, minimum = {}, maximum = {}, label = {}, pairs = {}, valid = {}, message_str = {}, code = {}, prepared = {}, message = {};
zend_class_entry *ce = Z_OBJCE_P(getThis());
phalcon_fetch_params(0, 2, 0, &validator, &attribute);
PHALCON_VERIFY_CLASS_EX(validator, phalcon_validation_ce, phalcon_validation_exception_ce, 0);
PHALCON_CALL_METHODW(&value, validator, "getvalue", attribute);
RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&allow_empty, ce, getThis(), ISV(allowEmpty)));
if (zend_is_true(&allow_empty) && phalcon_validation_validator_isempty_helper(&value)) {
RETURN_TRUE;
}
RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&minimum, ce, getThis(), "minimum"));
RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&maximum, ce, getThis(), "maximum"));
PHALCON_CALL_SELFW(&valid, "valid", &value, &minimum, &maximum);
if (PHALCON_IS_FALSE(&valid)) {
RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&label, ce, getThis(), ISV(label)));
if (!zend_is_true(&label)) {
PHALCON_CALL_METHODW(&label, validator, "getlabel", attribute);
if (!zend_is_true(&label)) {
PHALCON_CPY_WRT_CTOR(&label, attribute);
}
}
array_init_size(&pairs, 3);
phalcon_array_update_str(&pairs, SL(":field"), &label, PH_COPY);
phalcon_array_update_str(&pairs, SL(":min"), &minimum, PH_COPY);
phalcon_array_update_str(&pairs, SL(":max"), &maximum, PH_COPY);
RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&message_str, ce, getThis(), ISV(message)));
if (!zend_is_true(&message_str)) {
RETURN_ON_FAILURE(phalcon_validation_getdefaultmessage_helper(&message_str, Z_OBJCE_P(validator), validator, "Between"));
}
RETURN_ON_FAILURE(phalcon_validation_validator_getoption_helper(&code, ce, getThis(), ISV(code)));
if (Z_TYPE_P(&code) == IS_NULL) {
ZVAL_LONG(&code, 0);
}
PHALCON_CALL_FUNCTIONW(&prepared, "strtr", &message_str, &pairs);
phalcon_validation_message_construct_helper(&message, &prepared, attribute, "Between", &code);
PHALCON_CALL_METHODW(NULL, validator, "appendmessage", &message);
RETURN_FALSE;
}
RETURN_TRUE;
}
示例8: PHP_METHOD
PHP_METHOD(Phalcon_Http_Uri, resolve)
{
zval *uri, self = {};
phalcon_fetch_params(0, 1, 0, &uri);
object_init_ex(&self, phalcon_http_uri_ce);
PHALCON_CALL_METHODW(NULL, &self, "__construct", getThis());
PHALCON_CALL_METHODW(NULL, &self, "extend", uri);
RETURN_CTORW(&self);
}
示例9: PHP_METHOD
/**
* Applies a format to a message before sent it to the internal log
*
* @param string $message
* @param int $type
* @param int $timestamp
* @param array $context
* @return string
*/
PHP_METHOD(Phalcon_Logger_Formatter_Line, format){
zval *message, *type, *timestamp, *context, format = {}, date_format = {}, date = {}, date_wildcard = {}, new_format = {}, type_string = {}, type_wildcard = {}, message_wildcard = {};
phalcon_fetch_params(0, 4, 0, &message, &type, ×tamp, &context);
phalcon_return_property(&format, getThis(), SL("_format"));
/**
* Check if the format has the %date% placeholder
*/
if (phalcon_memnstr_str(&format, SL("%date%"))) {
phalcon_return_property(&date_format, getThis(), SL("_dateFormat"));
phalcon_date(&date, &date_format, timestamp);
ZVAL_STRING(&date_wildcard, "%date%");
PHALCON_STR_REPLACE(&new_format, &date_wildcard, &date, &format);
} else {
PHALCON_CPY_WRT(&new_format, &format);
}
/**
* Check if the format has the %type% placeholder
*/
if (phalcon_memnstr_str(&format, SL("%type%"))) {
PHALCON_CALL_METHODW(&type_string, getThis(), "gettypestring", type);
ZVAL_STRING(&type_wildcard, "%type%");
PHALCON_STR_REPLACE(&format, &type_wildcard, &type_string, &new_format);
} else {
PHALCON_CPY_WRT(&format, &new_format);
}
ZVAL_STRING(&message_wildcard, "%message%");
PHALCON_STR_REPLACE(&new_format, &message_wildcard, message, &format);
if (Z_TYPE_P(context) == IS_ARRAY && zend_hash_num_elements(Z_ARRVAL_P(context)) > 0) {
PHALCON_CALL_METHODW(&format, getThis(), "interpolate", &new_format, context);
}
else {
PHALCON_CPY_WRT(&format, &new_format);
}
PHALCON_CONCAT_VS(return_value, &format, PHP_EOL);
}
示例10: PHP_METHOD
/**
* Write hex string to the current position in the file pointer
*
* @return Phalcon\Binary\Writer
*/
PHP_METHOD(Phalcon_Binary_Writer, writeHexString){
zval *str, *length = NULL, *low_nibble = NULL, len = {}, format = {}, result = {};
phalcon_fetch_params(0, 1, 2, &str, &length, &low_nibble);
if (length && Z_TYPE_P(length) != IS_NULL) {
if (low_nibble && zend_is_true(low_nibble)) {
PHALCON_CONCAT_SV(&format, "h", length);
} else {
PHALCON_CONCAT_SV(&format, "H", length);
}
} else {
if (low_nibble && zend_is_true(low_nibble)) {
ZVAL_STRING(&format, "h*");
} else {
ZVAL_STRING(&format, "H*");
}
}
PHALCON_CALL_FUNCTIONW(&result, "pack", &format, str);
ZVAL_LONG(&len, Z_STRLEN(result));
PHALCON_CALL_METHODW(NULL, getThis(), "write", &result, &len);
RETURN_THISW();
}
示例11: PHP_METHOD
/**
* Load config file
*
* @param string $filePath
*/
PHP_METHOD(Phalcon_Config_Adapter_Yaml, read){
zval *file_path, *absolute_path = NULL, config_dir_path = {}, *base_path = NULL, config = {};
phalcon_fetch_params(0, 1, 1, &file_path, &absolute_path);
PHALCON_ENSURE_IS_STRING(file_path);
if (absolute_path == NULL) {
absolute_path = &PHALCON_GLOBAL(z_false);
}
if (zend_is_true(absolute_path)) {
PHALCON_CPY_WRT_CTOR(&config_dir_path, file_path);
} else {
base_path = phalcon_read_static_property_ce(phalcon_config_adapter_ce, SL("_basePath"));
PHALCON_CONCAT_VV(&config_dir_path, base_path, file_path);
}
PHALCON_CALL_FUNCTIONW(&config, "yaml_parse_file", &config_dir_path);
if (Z_TYPE(config) == IS_ARRAY) {
PHALCON_CALL_METHODW(NULL, getThis(), "val", &config);
}
RETURN_THISW();
}
示例12: PHP_METHOD
/**
* Initializes the internal handler, calling functions on it
*
* @param string $method
* @param array $arguments
* @return mixed
*/
PHP_METHOD(Phalcon_Mvc_Micro_LazyLoader, __call){
zval *method, *arguments, handler = {}, definition = {}, call_handler = {};
zend_class_entry *ce0;
phalcon_fetch_params(0, 2, 0, &method, &arguments);
phalcon_return_property(&handler, getThis(), SL("_handler"));
if (Z_TYPE(handler) != IS_OBJECT) {
phalcon_read_property(&definition, getThis(), SL("_definition"), PH_NOISY);
ce0 = phalcon_fetch_class(&definition, ZEND_FETCH_CLASS_DEFAULT);
PHALCON_OBJECT_INIT(&handler, ce0);
if (phalcon_has_constructor(&handler)) {
PHALCON_CALL_METHODW(NULL, &handler, "__construct");
}
phalcon_update_property_zval(getThis(), SL("_handler"), &handler);
}
array_init_size(&call_handler, 2);
phalcon_array_append(&call_handler, &handler, PH_COPY);
phalcon_array_append(&call_handler, method, PH_COPY);
/**
* Call the handler
*/
PHALCON_CALL_USER_FUNC_ARRAYW(return_value, &call_handler, arguments);
}
示例13: PHP_METHOD
/**
* Creates a form registering it in the forms manager
*
* @param string $name
* @param object $entity
* @return Phalcon\Forms\Form
*/
PHP_METHOD(Phalcon_Forms_Manager, create){
zval *name = NULL, *entity = NULL, form = {};
phalcon_fetch_params(0, 0, 2, &name, &entity);
if (!name) {
name = &PHALCON_GLOBAL(z_null);
}
if (!entity) {
entity = &PHALCON_GLOBAL(z_null);
}
if (Z_TYPE_P(name) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_forms_exception_ce, "The form name must be string");
return;
}
object_init_ex(&form, phalcon_forms_form_ce);
PHALCON_CALL_METHODW(NULL, &form, "__construct", entity);
phalcon_update_property_array(getThis(), SL("_forms"), name, &form);
RETURN_CTORW(&form);
}
示例14: PHP_METHOD
/**
* Decrement of a given key, by number $value
*
* @param string $keyName
* @param long $value
* @return mixed
*/
PHP_METHOD(Phalcon_Cache_Backend_Apc, decrement){
zval *key_name, *value = NULL, prefix = {}, prefixed_key = {}, cached_content = {};
phalcon_fetch_params(0, 1, 1, &key_name, &value);
if (!value || Z_TYPE_P(value) == IS_NULL) {
value = &PHALCON_GLOBAL(z_one);
} else {
PHALCON_ENSURE_IS_LONG(value);
}
phalcon_read_property(&prefix, getThis(), SL("_prefix"), PH_NOISY);
PHALCON_CONCAT_SVV(&prefixed_key, "_PHCA", &prefix, key_name);
phalcon_update_property_zval(getThis(), SL("_lastKey"), &prefixed_key);
if (SUCCESS == phalcon_function_exists_ex(SL("apc_dec"))) {
PHALCON_RETURN_CALL_FUNCTIONW("apc_dec", &prefixed_key, value);
} else {
PHALCON_CALL_FUNCTIONW(&cached_content, "apc_fetch", &prefixed_key);
if (Z_TYPE(cached_content) == IS_LONG) {
phalcon_sub_function(return_value, &cached_content, value);
PHALCON_CALL_METHODW(NULL, getThis(), "save", key_name, return_value);
} else {
RETURN_FALSE;
}
}
}
示例15: PHP_METHOD
/**
* Writes the log to the stream itself
*
* @param string $message
* @param int $type
* @param int $time
* @param array $context
*/
PHP_METHOD(Phalcon_Logger_Adapter_Stream, logInternal){
zval *message, *type, *time, *context, *stream, formatter = {}, applied_format = {};
phalcon_fetch_params(0, 4, 0, &message, &type, &time, &context);
stream = phalcon_read_property(getThis(), SL("_stream"), PH_NOISY);
if (Z_TYPE_P(stream) != IS_RESOURCE) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_logger_exception_ce, "Cannot send message to the log because it is invalid");
return;
}
PHALCON_CALL_METHODW(&formatter, getThis(), "getformatter");
PHALCON_CALL_METHODW(&applied_format, &formatter, "format", message, type, time, context);
PHALCON_CALL_FUNCTIONW(NULL, "fwrite", stream, &applied_format);
}