本文整理汇总了C++中phalcon_array_isset函数的典型用法代码示例。如果您正苦于以下问题:C++ phalcon_array_isset函数的具体用法?C++ phalcon_array_isset怎么用?C++ phalcon_array_isset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phalcon_array_isset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHP_METHOD
/**
* Magic __isset method
*
* @param string $key
* @return boolean
*/
PHP_METHOD(Phalcon_Http_Uri, __isset){
zval *key, parts = {};
phalcon_fetch_params(0, 1, 0, &key);
phalcon_read_property(&parts, getThis(), SL("_parts"), PH_NOISY);
RETURN_BOOL(phalcon_array_isset(&parts, key));
}
示例2: 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;
}
示例3: PHP_METHOD
/**
* Gets hasMany related records from a model
*
* @param string $method
* @param string $modelName
* @param string $modelRelation
* @param Phalcon\Mvc\Model $record
* @param array $parameters
* @return Phalcon\Mvc\Model\Resultset
*/
PHP_METHOD(Phalcon_Mvc_Model_Manager, getHasManyRecords){
zval *method, *model_name, *model_relation, *record;
zval *parameters = NULL, *has_many, *relation, *records;
zval *r0 = NULL, *r1 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzzz|z", &method, &model_name, &model_relation, &record, ¶meters) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!parameters) {
PHALCON_INIT_NVAR(parameters);
}
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(r0);
phalcon_array_fetch(&r0, has_many, model_name, PH_NOISY_CC);
eval_int = phalcon_array_isset(r0, model_relation);
if (!eval_int) {
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
}
PHALCON_INIT_VAR(r1);
phalcon_array_fetch(&r1, has_many, model_name, PH_NOISY_CC);
PHALCON_INIT_VAR(relation);
phalcon_array_fetch(&relation, r1, model_relation, PH_NOISY_CC);
PHALCON_INIT_VAR(records);
PHALCON_CALL_METHOD_PARAMS_4(records, this_ptr, "_getrelationrecords", relation, method, record, parameters, PH_NO_CHECK);
RETURN_CCTOR(records);
}
示例4: PHP_METHOD
/**
* Returns the connection related to a model
*
* @param Phalcon\Mvc\CollectionInterface $model
* @return Phalcon\Db\AdapterInterface
*/
PHP_METHOD(Phalcon_Mvc_Collection_Manager, getConnection){
zval *model, *service = NULL, *connection_services;
zval *entity_name, *dependency_injector, *connection;
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(service);
ZVAL_STRING(service, "mongo", 1);
PHALCON_OBS_VAR(connection_services);
phalcon_read_property_this(&connection_services, this_ptr, SL("_connectionServices"), PH_NOISY_CC);
if (Z_TYPE_P(connection_services) == IS_ARRAY) {
PHALCON_INIT_VAR(entity_name);
phalcon_get_class(entity_name, model, 1 TSRMLS_CC);
/**
* Check if the model has a custom connection service
*/
if (phalcon_array_isset(connection_services, entity_name)) {
PHALCON_OBS_NVAR(service);
phalcon_array_fetch(&service, connection_services, entity_name, PH_NOISY_CC);
}
}
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_mvc_model_exception_ce, "A dependency injector container is required to obtain the services related to the ORM");
return;
}
/**
* Request the connection service from the DI
*/
PHALCON_INIT_VAR(connection);
PHALCON_CALL_METHOD_PARAMS_1(connection, dependency_injector, "getshared", service);
if (Z_TYPE_P(connection) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "Invalid injected connection service");
return;
}
RETURN_CCTOR(connection);
}
示例5: PHP_METHOD
/**
* Checks whether $_SERVER superglobal has certain index
*
* @param string $name
* @return mixed
*/
PHP_METHOD(Phalcon_Http_Request, hasServer){
zval *name, *_SERVER;
phalcon_fetch_params(0, 1, 0, &name);
phalcon_get_global(&_SERVER, SS("_SERVER") TSRMLS_CC);
if (phalcon_array_isset(_SERVER, name)) {
RETURN_TRUE;
}
RETURN_FALSE;
}
示例6: PHP_METHOD
/**
* bool \Phalcon\Flash\Session::has(string $type)
*
* @see https://github.com/phalcon/cphalcon/issues/1342
*/
PHP_METHOD(Phalcon_Flash_Session, has) {
zval *type, *messages = NULL;
phalcon_fetch_params(0, 0, 1, &type);
PHALCON_MM_GROW();
PHALCON_CALL_METHOD(&messages, this_ptr, "_getsessionmessages", PHALCON_GLOBAL(z_false));
RETVAL_BOOL(phalcon_array_isset(messages, type));
PHALCON_MM_RESTORE();
}
示例7: PHP_METHOD
/**
* Adds a role to the ACL list. Second parameter allows inheriting access data from other existing role
*
* Example:
* <code>
* $acl->addRole(new Phalcon\Acl\Role('administrator'), 'consultant');
* $acl->addRole('administrator', 'consultant');
* </code>
*
* @param Phalcon\Acl\RoleInterface $role
* @param array|string $accessInherits
* @return boolean
*/
PHP_METHOD(Phalcon_Acl_Adapter_Memory, addRole){
zval *role, *access_inherits = NULL, *role_name = NULL, *object = NULL;
zval *roles_names, *exists, *default_access;
zval *key, *success;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 1, 1, &role, &access_inherits);
if (!access_inherits) {
PHALCON_INIT_VAR(access_inherits);
}
if (Z_TYPE_P(role) == IS_OBJECT) {
PHALCON_INIT_VAR(role_name);
phalcon_call_method(role_name, role, "getname");
PHALCON_CPY_WRT(object, role);
} else {
PHALCON_CPY_WRT(role_name, role);
PHALCON_INIT_NVAR(object);
object_init_ex(object, phalcon_acl_role_ce);
phalcon_call_method_p1_noret(object, "__construct", role);
}
PHALCON_OBS_VAR(roles_names);
phalcon_read_property_this(&roles_names, this_ptr, SL("_rolesNames"), PH_NOISY_CC);
if (phalcon_array_isset(roles_names, role_name)) {
RETURN_MM_FALSE;
}
PHALCON_INIT_VAR(exists);
ZVAL_BOOL(exists, 1);
phalcon_update_property_array_append(this_ptr, SL("_roles"), object TSRMLS_CC);
phalcon_update_property_array(this_ptr, SL("_rolesNames"), role_name, exists TSRMLS_CC);
PHALCON_OBS_VAR(default_access);
phalcon_read_property_this(&default_access, this_ptr, SL("_defaultAccess"), PH_NOISY_CC);
PHALCON_INIT_VAR(key);
PHALCON_CONCAT_VS(key, role_name, "!*!*");
phalcon_update_property_array(this_ptr, SL("_access"), key, default_access TSRMLS_CC);
if (Z_TYPE_P(access_inherits) != IS_NULL) {
PHALCON_INIT_VAR(success);
phalcon_call_method_p2(success, this_ptr, "addinherit", role_name, access_inherits);
RETURN_CCTOR(success);
}
RETURN_MM_TRUE;
}
示例8: 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);
}
示例9: PHP_METHOD
/**
* Check if the current element in the iterator is valid
*
* @return boolean
*/
PHP_METHOD(Phalcon_Assets_Collection, valid){
zval *position, *resources;
position = phalcon_read_property(getThis(), SL("_position"), PH_NOISY);
resources = phalcon_read_property(getThis(), SL("_resources"), PH_NOISY);
if (phalcon_array_isset(resources, position)) {
RETURN_TRUE;
}
RETURN_FALSE;
}
示例10: PHP_METHOD
/**
* Gets a value from the the internal related entity or from the default value
*
* @param string $name
* @return mixed
*/
PHP_METHOD(Phalcon_Forms_Form, getValue){
zval *name, *entity, *method, *value = NULL, *data;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &name) == FAILURE) {
RETURN_MM_NULL();
}
PHALCON_OBS_VAR(entity);
phalcon_read_property(&entity, this_ptr, SL("_entity"), PH_NOISY_CC);
if (Z_TYPE_P(entity) == IS_OBJECT) {
/**
* Check if the entity has a getter
*/
PHALCON_INIT_VAR(method);
PHALCON_CONCAT_SV(method, "get", name);
if (phalcon_method_exists(entity, method TSRMLS_CC) == SUCCESS) {
PHALCON_INIT_VAR(value);
PHALCON_CALL_METHOD(value, entity, Z_STRVAL_P(method));
RETURN_CCTOR(value);
}
/**
* Check if the entity has a public property
*/
if (phalcon_isset_property_zval(entity, name TSRMLS_CC)) {
PHALCON_OBS_NVAR(value);
phalcon_read_property_zval(&value, entity, name, PH_NOISY_CC);
RETURN_CCTOR(value);
}
}
PHALCON_OBS_VAR(data);
phalcon_read_property(&data, this_ptr, SL("_data"), PH_NOISY_CC);
if (Z_TYPE_P(data) == IS_ARRAY) {
/**
* Check if the data is in the data array
*/
if (phalcon_array_isset(data, name)) {
PHALCON_OBS_NVAR(value);
phalcon_array_fetch(&value, data, name, PH_NOISY_CC);
RETURN_CCTOR(value);
}
}
RETURN_MM_NULL();
}
示例11: PHP_METHOD
/**
* Gets variable from $_POST superglobal applying filters if needed
*
* @param string $name
* @param string|array $filters
* @return mixed
*/
PHP_METHOD(Phalcon_Http_Request, getPost){
zval *name = NULL, *filters = NULL, *value = NULL, *dependency_injector = NULL;
zval *filter = NULL, *sanitized_value = NULL;
zval *g0 = NULL;
zval *c0 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &name, &filters) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
if (!filters) {
PHALCON_ALLOC_ZVAL_MM(filters);
ZVAL_NULL(filters);
}
phalcon_get_global(&g0, SL("_POST")+1 TSRMLS_CC);
eval_int = phalcon_array_isset(g0, name);
if (eval_int) {
PHALCON_INIT_VAR(value);
phalcon_array_fetch(&value, g0, name, PH_NOISY_CC);
if (zend_is_true(filters)) {
PHALCON_INIT_VAR(dependency_injector);
phalcon_read_property(&dependency_injector, this_ptr, SL("_dependencyInjector"), PH_NOISY_CC);
if (!zend_is_true(dependency_injector)) {
PHALCON_THROW_EXCEPTION_STR(phalcon_http_request_exception_ce, "A dependency injection object is required to access the 'filter' service");
return;
}
PHALCON_INIT_VAR(c0);
ZVAL_STRING(c0, "filter", 1);
PHALCON_INIT_VAR(filter);
PHALCON_CALL_METHOD_PARAMS_1(filter, dependency_injector, "getshared", c0, PH_NO_CHECK);
PHALCON_INIT_VAR(sanitized_value);
PHALCON_CALL_METHOD_PARAMS_2(sanitized_value, filter, "sanitize", value, filters, PH_NO_CHECK);
RETURN_CCTOR(sanitized_value);
} else {
RETURN_CCTOR(value);
}
}
PHALCON_MM_RESTORE();
RETURN_NULL();
}
示例12: PHP_METHOD
/**
* Returns the messages in the session flasher
*
* @param string $type
* @param boolean $remove
* @return array
*/
PHP_METHOD(Phalcon_Flash_Session, getMessages){
zval *type = NULL, *remove = NULL, *messages, *return_messages;
zval *do_remove;
PHALCON_MM_GROW();
phalcon_fetch_params(1, 0, 2, &type, &remove);
if (!type) {
PHALCON_INIT_VAR(type);
}
if (!remove) {
PHALCON_INIT_VAR(remove);
ZVAL_BOOL(remove, 1);
}
if (Z_TYPE_P(type) != IS_NULL) {
PHALCON_INIT_VAR(do_remove);
ZVAL_FALSE(do_remove);
}
else {
do_remove = remove;
}
PHALCON_INIT_VAR(messages);
phalcon_call_method_p1(messages, this_ptr, "_getsessionmessages", do_remove);
if (Z_TYPE_P(messages) == IS_ARRAY) {
if (likely(Z_TYPE_P(type) != IS_NULL)) {
if (phalcon_array_isset(messages, type)) {
PHALCON_OBS_VAR(return_messages);
phalcon_array_fetch(&return_messages, messages, type, PH_NOISY);
RETVAL_ZVAL(return_messages, 1, 0);
if (zend_is_true(remove)) {
phalcon_array_unset(&messages, type, 0);
phalcon_call_method_p1_noret(this_ptr, "_setsessionmessages", messages);
}
PHALCON_MM_RESTORE();
return;
}
RETURN_MM_EMPTY_ARRAY();
}
RETURN_CCTOR(messages);
}
RETURN_MM_EMPTY_ARRAY();
}
示例13: PHP_METHOD
/**
* Gets belongsTo related records from a model
*
* @param string $method
* @param string $modelName
* @param string $modelRelation
* @param Phalcon\Mvc\Model $record
* @return Phalcon\Mvc\Model\Resultset
*/
PHP_METHOD(Phalcon_Mvc_Model_Manager, getBelongsToRecords){
zval *method = NULL, *model_name = NULL, *model_relation = NULL, *record = NULL;
zval *belongs_to = NULL, *relation = NULL, *records = NULL;
zval *r0 = NULL, *r1 = NULL;
int eval_int;
PHALCON_MM_GROW();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zzzz", &method, &model_name, &model_relation, &record) == FAILURE) {
PHALCON_MM_RESTORE();
RETURN_NULL();
}
PHALCON_INIT_VAR(belongs_to);
phalcon_read_property(&belongs_to, this_ptr, SL("_belongsTo"), PH_NOISY_CC);
eval_int = phalcon_array_isset(belongs_to, model_name);
if (eval_int) {
PHALCON_ALLOC_ZVAL_MM(r0);
phalcon_array_fetch(&r0, belongs_to, model_name, PH_NOISY_CC);
eval_int = phalcon_array_isset(r0, model_relation);
if (!eval_int) {
PHALCON_MM_RESTORE();
RETURN_FALSE;
}
}
PHALCON_ALLOC_ZVAL_MM(r1);
phalcon_array_fetch(&r1, belongs_to, model_name, PH_NOISY_CC);
PHALCON_INIT_VAR(relation);
phalcon_array_fetch(&relation, r1, model_relation, PH_NOISY_CC);
PHALCON_INIT_VAR(records);
PHALCON_CALL_METHOD_PARAMS_3(records, this_ptr, "_getrelationrecords", relation, method, record, PH_NO_CHECK);
RETURN_CCTOR(records);
}
示例14: PHP_METHOD
/**
* Reads meta-data for certain model using a MODEL_* constant
*
* @param Phalcon\Mvc\Model $model
* @param int $index
*/
PHP_METHOD(Phalcon_Mvc_Model_MetaData, readMetaDataIndex){
zval *model, *index, *table, *schema, *key, *meta_data = NULL;
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(table);
PHALCON_CALL_METHOD(table, model, "getsource", PH_NO_CHECK);
PHALCON_INIT_VAR(schema);
PHALCON_CALL_METHOD(schema, model, "getschema", PH_NO_CHECK);
PHALCON_INIT_VAR(key);
PHALCON_CONCAT_VV(key, schema, table);
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_CALL_METHOD_PARAMS_4_NORETURN(this_ptr, "_initializemetadata", model, key, table, schema, PH_NO_CHECK);
PHALCON_INIT_NVAR(meta_data);
phalcon_read_property(&meta_data, this_ptr, SL("_metaData"), PH_NOISY_CC);
}
PHALCON_INIT_VAR(r0);
phalcon_array_fetch(&r0, meta_data, key, PH_NOISY_CC);
PHALCON_INIT_VAR(attributes);
phalcon_array_fetch(&attributes, r0, index, PH_NOISY_CC);
RETURN_CCTOR(attributes);
}
示例15: PHP_METHOD
/**
* Check whether a model is already initialized
*
* @param string $modelName
* @return bool
*/
PHP_METHOD(Phalcon_Mvc_Collection_Manager, isInitialized){
zval *model_name, *initialized, *lowercased;
phalcon_fetch_params(0, 1, 0, &model_name);
initialized = phalcon_fetch_nproperty_this(this_ptr, SL("_initialized"), PH_NOISY TSRMLS_CC);
ALLOC_INIT_ZVAL(lowercased);
phalcon_fast_strtolower(lowercased, model_name);
RETVAL_BOOL(phalcon_array_isset(initialized, lowercased));
zval_ptr_dtor(&lowercased);
}