本文整理汇总了C++中PHALCON_CALL_METHOD_PARAMS_1函数的典型用法代码示例。如果您正苦于以下问题:C++ PHALCON_CALL_METHOD_PARAMS_1函数的具体用法?C++ PHALCON_CALL_METHOD_PARAMS_1怎么用?C++ PHALCON_CALL_METHOD_PARAMS_1使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHALCON_CALL_METHOD_PARAMS_1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Returns a local path
*
* @param array|string $params
* @return string
*/
PHP_METHOD(Phalcon_Mvc_View_Engine, path){
zval *params = NULL, *dependency_injector = NULL, *url = NULL;
zval *c0 = NULL;
zval *r0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", ¶ms) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!params) {
PHALCON_ALLOC_ZVAL_MM(params);
ZVAL_STRING(params, "", 1);
}
PHALCON_INIT_VAR(dependency_injector);
phalcon_read_property(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_view_exception_ce, "A dependency injector container is required to obtain the 'url' service");
return;
}
PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "url", 1);
PHALCON_INIT_VAR(url);
PHALCON_CALL_METHOD_PARAMS_1(url, dependency_injector, "getshared", c0, PH_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_METHOD_PARAMS_1(r0, url, "getpath", params, PH_NO_CHECK);
RETURN_CTOR(r0);
}
示例2: PHP_METHOD
/**
* Check that the options are valid
*
*/
PHP_METHOD(Phalcon_Model_Validator_Exclusionin, checkOptions) {
zval *r0 = NULL, *r1 = NULL, *r2 = NULL;
zval *c0 = NULL, *c1 = NULL;
PHALCON_MM_GROW();
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "domain", 1);
PHALCON_CALL_METHOD_PARAMS_1(r0, this_ptr, "issetoption", c0, PHALCON_NO_CHECK);
if (!zend_is_true(r0)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_model_exception_ce, "The option 'domain' is required for this validator");
return;
}
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_ALLOC_ZVAL_MM(r2);
PHALCON_INIT_VAR(c1);
ZVAL_STRING(c1, "domain", 1);
PHALCON_CALL_METHOD_PARAMS_1(r2, this_ptr, "getoption", c1, PHALCON_NO_CHECK);
PHALCON_CALL_FUNC_PARAMS_1(r1, "is_array", r2, 0x03D);
if (!zend_is_true(r1)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_model_exception_ce, "Option 'domain' must be an array");
return;
}
PHALCON_MM_RESTORE();
}
示例3: PHP_METHOD
/**
* Check if a model has certain attribute
*
*<code>
* var_dump($metaData->hasAttribute(new Robots(), 'name'));
*</code>
*
* @param Phalcon\Mvc\ModelInterface $model
* @param string $attribute
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, hasAttribute){
zval *model, *attribute, *column_map, *meta_data;
zval *data_types;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &model, &attribute) == FAILURE) {
RETURN_MM_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);
if (Z_TYPE_P(column_map) == IS_ARRAY) {
if (phalcon_array_isset(column_map, attribute)) {
RETURN_MM_TRUE;
}
} else {
PHALCON_INIT_VAR(meta_data);
PHALCON_CALL_METHOD_PARAMS_1(meta_data, this_ptr, "readmetadata", model);
PHALCON_OBS_VAR(data_types);
phalcon_array_fetch_long(&data_types, meta_data, 4, PH_NOISY_CC);
if (phalcon_array_isset(data_types, attribute)) {
RETURN_MM_TRUE;
}
}
RETURN_MM_FALSE;
}
示例4: PHP_METHOD
/**
* Returns the messages stored in session
*
* @param boolean $remove
* @return array
*/
PHP_METHOD(Phalcon_Flash_Session, _getSessionMessages){
zval *remove, *dependency_injector, *service;
zval *session, *index_name, *messages;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &remove);
PHALCON_OBS_VAR(dependency_injector);
phalcon_read_property_this(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_flash_exception_ce, "A dependency injection container is required to access the 'session' service");
return;
}
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "session", 1);
PHALCON_INIT_VAR(session);
PHALCON_CALL_METHOD_PARAMS_1(session, dependency_injector, "getshared", service);
PHALCON_INIT_VAR(index_name);
ZVAL_STRING(index_name, "_flashMessages", 1);
PHALCON_INIT_VAR(messages);
PHALCON_CALL_METHOD_PARAMS_1(messages, session, "get", index_name);
if (PHALCON_IS_TRUE(remove)) {
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(session, "remove", index_name);
}
RETURN_CCTOR(messages);
}
示例5: PHP_METHOD
/**
* Executes the validation
*
* @param Phalcon\Validation $validator
* @param string $attribute
* @return boolean
*/
PHP_METHOD(Phalcon_Validation_Validator_InclusionIn, validate){
zval *validator, *attribute, *value, *option = NULL, *domain;
zval *message_str = NULL, *joined_domain, *type, *message;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &validator, &attribute) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_INIT_VAR(value);
PHALCON_CALL_METHOD_PARAMS_1(value, validator, "getvalue", attribute);
/**
* A domain is an array with a list of valid values
*/
PHALCON_INIT_VAR(option);
ZVAL_STRING(option, "domain", 1);
PHALCON_INIT_VAR(domain);
PHALCON_CALL_METHOD_PARAMS_1(domain, this_ptr, "getoption", option);
if (Z_TYPE_P(domain) != IS_ARRAY) {
PHALCON_THROW_EXCEPTION_STR(phalcon_validation_exception_ce, "Option 'domain' must be an array");
return;
}
/**
* Check if the value is contained by the array
*/
if (!phalcon_fast_in_array(value, domain TSRMLS_CC)) {
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "message", 1);
PHALCON_INIT_VAR(message_str);
PHALCON_CALL_METHOD_PARAMS_1(message_str, this_ptr, "getoption", option);
if (!zend_is_true(message_str)) {
PHALCON_INIT_VAR(joined_domain);
phalcon_fast_join_str(joined_domain, SL(", "), domain TSRMLS_CC);
PHALCON_INIT_NVAR(message_str);
PHALCON_CONCAT_SVSV(message_str, "Value of field '", attribute, "' must be part of list: ", joined_domain);
}
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "InclusionIn", 1);
PHALCON_INIT_VAR(message);
object_init_ex(message, phalcon_validation_message_ce);
PHALCON_CALL_METHOD_PARAMS_3_NORETURN(message, "__construct", message_str, attribute, type);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(validator, "appendmessage", message);
RETURN_MM_FALSE;
}
RETURN_MM_TRUE;
}
示例6: PHP_METHOD
/**
* Redirect by HTTP to another action or URL
*
*<code>
* //Using a string redirect (internal/external)
* $response->redirect("posts/index");
* $response->redirect("http://en.wikipedia.org", true);
* $response->redirect("http://www.example.com/new-location", true, 301);
*</code>
*
* @param string $location
* @param boolean $externalRedirect
* @param int $statusCode
* @return Phalcon\Http\ResponseInterface
*/
PHP_METHOD(Phalcon_Http_Response, redirect){
zval *location = NULL, *external_redirect = NULL, *status_code = NULL;
zval *header = NULL, *dependency_injector, *service;
zval *url, *status_text, *header_name;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zzz", &location, &external_redirect, &status_code) == FAILURE) {
RETURN_MM_NULL();
}
if (!location) {
PHALCON_INIT_VAR(location);
}
if (!external_redirect) {
PHALCON_INIT_VAR(external_redirect);
ZVAL_BOOL(external_redirect, 0);
}
if (!status_code) {
PHALCON_INIT_VAR(status_code);
ZVAL_LONG(status_code, 302);
}
if (zend_is_true(external_redirect)) {
PHALCON_CPY_WRT(header, location);
} else {
PHALCON_INIT_VAR(dependency_injector);
PHALCON_CALL_METHOD(dependency_injector, this_ptr, "getdi");
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "url", 1);
PHALCON_INIT_VAR(url);
PHALCON_CALL_METHOD_PARAMS_1(url, dependency_injector, "getshared", service);
PHALCON_INIT_VAR(header);
PHALCON_CALL_METHOD_PARAMS_1(header, url, "get", location);
}
/**
* The HTTP status is 302 by default, a temporary redirection
*/
PHALCON_INIT_VAR(status_text);
ZVAL_STRING(status_text, "Redirect", 1);
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "setstatuscode", status_code, status_text);
/**
* Change the current location using 'Location'
*/
PHALCON_INIT_VAR(header_name);
ZVAL_STRING(header_name, "Location", 1);
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "setheader", header_name, header);
RETURN_THIS();
}
示例7: PHP_METHOD
/**
* Executes the validator
*
* @param Phalcon\Mvc\ModelInterface $record
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_Validator_Numericality, validate){
zval *record, *option = NULL, *field, *value, *is_numeric;
zval *message = NULL, *type;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &record) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(option);
ZVAL_STRING(option, "field", 1);
PHALCON_INIT_VAR(field);
PHALCON_CALL_METHOD_PARAMS_1(field, this_ptr, "getoption", option, PH_NO_CHECK);
if (Z_TYPE_P(field) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Field name must be a string");
return;
}
PHALCON_INIT_VAR(value);
PHALCON_CALL_METHOD_PARAMS_1(value, record, "readattribute", field, PH_NO_CHECK);
/**
* Check if the value is numeric using is_numeric in the PHP userland
*/
PHALCON_INIT_VAR(is_numeric);
PHALCON_CALL_FUNC_PARAMS_1(is_numeric, "is_numeric", value);
if (!zend_is_true(is_numeric)) {
/**
* Check if the developer has defined a custom message
*/
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "message", 1);
PHALCON_INIT_VAR(message);
PHALCON_CALL_METHOD_PARAMS_1(message, this_ptr, "getoption", option, PH_NO_CHECK);
if (!zend_is_true(message)) {
PHALCON_INIT_NVAR(message);
PHALCON_CONCAT_SVS(message, "Value of field '", field, "' must be numeric");
}
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "Numericality", 1);
PHALCON_CALL_METHOD_PARAMS_3_NORETURN(this_ptr, "appendmessage", message, field, type, PH_NO_CHECK);
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
PHALCON_MM_RESTORE();
RETURN_TRUE;
}
示例8: PHP_METHOD
/**
* Executes the validator
*
* @param Phalcon\Mvc\ModelInterface $record
* @return boolean
*/
PHP_METHOD(Phalcon_Mvc_Model_Validator_PresenceOf, validate){
zval *record, *option = NULL, *field_name, *value, *message = NULL;
zval *type;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &record) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(option);
ZVAL_STRING(option, "field", 1);
PHALCON_INIT_VAR(field_name);
PHALCON_CALL_METHOD_PARAMS_1(field_name, this_ptr, "getoption", option, PH_NO_CHECK);
if (Z_TYPE_P(field_name) != IS_STRING) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Field name must be a string");
return;
}
/**
* A value is null when it is identical to null or a empty string
*/
PHALCON_INIT_VAR(value);
PHALCON_CALL_METHOD_PARAMS_1(value, record, "readattribute", field_name, PH_NO_CHECK);
if (PHALCON_IS_EMPTY(value)) {
/**
* Check if the developer has defined a custom message
*/
PHALCON_INIT_NVAR(option);
ZVAL_STRING(option, "message", 1);
PHALCON_INIT_VAR(message);
PHALCON_CALL_METHOD_PARAMS_1(message, this_ptr, "getoption", option, PH_NO_CHECK);
if (!zend_is_true(message)) {
PHALCON_INIT_NVAR(message);
PHALCON_CONCAT_SVS(message, "'", field_name, "' is required");
}
PHALCON_INIT_VAR(type);
ZVAL_STRING(type, "PresenceOf", 1);
PHALCON_CALL_METHOD_PARAMS_3_NORETURN(this_ptr, "appendmessage", message, field_name, type, PH_NO_CHECK);
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
PHALCON_MM_RESTORE();
RETURN_TRUE;
}
示例9: PHP_METHOD
/**
* Return a URL service from the DI
*
* @return Phalcon\Mvc\UrlInterface
*/
PHP_METHOD(Phalcon_Tag, getUrlService){
zval *url = NULL, *dependency_injector = NULL, *service;
PHALCON_MM_GROW();
PHALCON_OBSERVE_VAR(url);
phalcon_read_static_property(&url, SL("phalcon\\tag"), SL("_urlService") TSRMLS_CC);
if (Z_TYPE_P(url) == IS_NULL) {
PHALCON_OBSERVE_VAR(dependency_injector);
phalcon_read_static_property(&dependency_injector, SL("phalcon\\tag"), SL("_dependencyInjector") TSRMLS_CC);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_INIT_NVAR(dependency_injector);
PHALCON_CALL_STATIC(dependency_injector, "phalcon\\di", "getdefault");
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_tag_exception_ce, "A dependency injector container is required to obtain the \"url\" service");
return;
}
PHALCON_INIT_VAR(service);
ZVAL_STRING(service, "url", 1);
PHALCON_INIT_NVAR(url);
PHALCON_CALL_METHOD_PARAMS_1(url, dependency_injector, "getshared", service, PH_NO_CHECK);
phalcon_update_static_property(SL("phalcon\\tag"), SL("_urlService"), url TSRMLS_CC);
}
RETURN_CCTOR(url);
}
示例10: PHP_METHOD
/**
* Returns insert id for the auto_increment column inserted in the last SQL statement
*
* @param string $sequenceName
* @return int
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, lastInsertId){
zval *sequence_name = NULL, *pdo = NULL, *insert_id = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &sequence_name) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!sequence_name) {
PHALCON_ALLOC_ZVAL_MM(sequence_name);
ZVAL_NULL(sequence_name);
}
PHALCON_INIT_VAR(pdo);
phalcon_read_property(&pdo, this_ptr, SL("_pdo"), PH_NOISY_CC);
if (Z_TYPE_P(pdo) != IS_OBJECT) {
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
PHALCON_INIT_VAR(insert_id);
PHALCON_CALL_METHOD_PARAMS_1(insert_id, pdo, "lastinsertid", sequence_name, PH_NO_CHECK);
RETURN_CCTOR(insert_id);
}
示例11: PHP_METHOD
/**
* Gets HTTP schema (http/https)
*
* @return string
*/
PHP_METHOD(Phalcon_Http_Request, getScheme){
zval *https_header, *https, *scheme = NULL;
PHALCON_MM_GROW();
PHALCON_INIT_VAR(https_header);
ZVAL_STRING(https_header, "HTTPS", 1);
PHALCON_INIT_VAR(https);
PHALCON_CALL_METHOD_PARAMS_1(https, this_ptr, "getserver", https_header);
if (zend_is_true(https)) {
if (PHALCON_IS_STRING(https, "off")) {
PHALCON_INIT_VAR(scheme);
ZVAL_STRING(scheme, "http", 1);
} else {
PHALCON_INIT_NVAR(scheme);
ZVAL_STRING(scheme, "https", 1);
}
} else {
PHALCON_INIT_NVAR(scheme);
ZVAL_STRING(scheme, "http", 1);
}
RETURN_CTOR(scheme);
}
示例12: PHP_METHOD
/**
* Checks for annotations in the controller docblock
*
* @param string $handler
* @param Phalcon\Annotations\AdapterInterface
*/
PHP_METHOD(Phalcon_Mvc_Router_Annotations, processControllerAnnotation){
zval *handler, *annotation, *lowercased, *name;
zval *position, *value;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &handler, &annotation) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_INIT_VAR(lowercased);
phalcon_fast_strtolower(lowercased, handler);
PHALCON_INIT_VAR(name);
PHALCON_CALL_METHOD(name, annotation, "getname");
/**
* @RoutePrefix add a prefix for all the routes defined in the model
*/
if (PHALCON_IS_STRING(name, "RoutePrefix")) {
PHALCON_INIT_VAR(position);
ZVAL_LONG(position, 0);
PHALCON_INIT_VAR(value);
PHALCON_CALL_METHOD_PARAMS_1(value, annotation, "getargument", position);
phalcon_update_property_zval(this_ptr, SL("_routePrefix"), value TSRMLS_CC);
}
PHALCON_MM_RESTORE();
}
示例13: PHP_METHOD
/**
* Drops a table from a schema/database
*
* @param string $tableName
* @param string $schemaName
* @param boolean $ifExists
* @return boolean
*/
PHP_METHOD(Phalcon_Db_Adapter_Pdo, dropTable){
zval *table_name = NULL, *schema_name = NULL, *if_exists = NULL, *sql = NULL;
zval *t0 = NULL;
zval *r0 = NULL;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|z", &table_name, &schema_name, &if_exists) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!if_exists) {
PHALCON_ALLOC_ZVAL_MM(if_exists);
ZVAL_BOOL(if_exists, 1);
}
PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_dialect"), PH_NOISY_CC);
PHALCON_INIT_VAR(sql);
PHALCON_CALL_METHOD_PARAMS_3(sql, t0, "droptable", table_name, schema_name, if_exists, PH_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_CALL_METHOD_PARAMS_1(r0, this_ptr, "execute", sql, PH_NO_CHECK);
RETURN_CTOR(r0);
}
示例14: PHP_METHOD
/**
* Returns a Dispatcher service from the DI
*
* @return Phalcon\Mvc\Dispatcher
*/
PHP_METHOD(Phalcon_Tag, getDispatcherService){
zval *dependency_injector = NULL, *dispatcher = NULL;
zval *c0 = NULL;
PHALCON_MM_GROW();
PHALCON_OBSERVE_VAR(dependency_injector);
phalcon_read_static_property(&dependency_injector, SL("phalcon\\tag"), SL("_dependencyInjector") TSRMLS_CC);
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_INIT_VAR(dependency_injector);
PHALCON_CALL_STATIC(dependency_injector, "phalcon\\di", "getdefault");
}
if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_tag_exception_ce, "A dependency injector container is required to obtain the \"dispatcher\" service");
return;
}
PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "dispatcher", 1);
PHALCON_INIT_VAR(dispatcher);
PHALCON_CALL_METHOD_PARAMS_1(dispatcher, dependency_injector, "getshared", c0, PH_NO_CHECK);
RETURN_CCTOR(dispatcher);
}
示例15: PHP_METHOD
/**
* Returns the annotations found in all the class' methods
*
* @param string $className
* @return array
*/
PHP_METHOD(Phalcon_Annotations_Adapter, getProperties){
zval *class_name, *class_annotations, *properties = NULL;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 0, &class_name);
/**
* Get the full annotations from the class
*/
PHALCON_INIT_VAR(class_annotations);
PHALCON_CALL_METHOD_PARAMS_1(class_annotations, this_ptr, "get", class_name);
/**
* A valid annotations reflection is an object
*/
if (Z_TYPE_P(class_annotations) == IS_OBJECT) {
PHALCON_INIT_VAR(properties);
PHALCON_CALL_METHOD(properties, class_annotations, "getpropertiesannotations");
RETURN_CCTOR(properties);
}
PHALCON_INIT_NVAR(properties);
array_init(properties);
RETURN_CCTOR(properties);
}