/** * Starts the profile of a SQL sentence * * @param string $sqlStatement * @return Phalcon\Db\Profiler */ PHP_METHOD(Phalcon_Db_Profiler, startProfile){ zval *sql_statement, *active_profile, *micro; zval *time; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &sql_statement) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(active_profile); object_init_ex(active_profile, phalcon_db_profiler_item_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(active_profile, "setsqlstatement", sql_statement, PH_NO_CHECK); PHALCON_INIT_VAR(micro); ZVAL_BOOL(micro, 1); PHALCON_INIT_VAR(time); PHALCON_CALL_FUNC_PARAMS_1(time, "microtime", micro); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(active_profile, "setinitialtime", time, PH_NO_CHECK); if (phalcon_method_exists_ex(this_ptr, SS("beforestartprofile") TSRMLS_CC) == SUCCESS) { PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "beforestartprofile", active_profile, PH_NO_CHECK); } phalcon_update_property_zval(this_ptr, SL("_activeProfile"), active_profile TSRMLS_CC); RETURN_CTOR(this_ptr); }
/** * Creates a Phalcon\Mvc\Model\Query and execute it * * @param string $phql * @param array $placeholders * @return Phalcon\Mvc\Model\Query */ PHP_METHOD(Phalcon_Mvc_Model_Manager, executeQuery){ zval *phql = NULL, *placeholders = NULL, *dependency_injector = NULL; zval *query = NULL, *result = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &phql, &placeholders) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!placeholders) { PHALCON_ALLOC_ZVAL_MM(placeholders); ZVAL_NULL(placeholders); } 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_model_exception_ce, "A dependency injection object is required to access ORM services"); return; } PHALCON_INIT_VAR(query); object_init_ex(query, phalcon_mvc_model_query_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(query, "__construct", phql, PH_CHECK); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(query, "setdi", dependency_injector, PH_NO_CHECK); PHALCON_INIT_VAR(result); PHALCON_CALL_METHOD_PARAMS_1(result, query, "execute", placeholders, PH_NO_CHECK); RETURN_CCTOR(result); }
/** * Gets the models manager * * @return Phalcon_Model_Manager */ PHP_METHOD(Phalcon_Controller_Front, getModelComponent){ zval *model = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL; zval *i0 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_model", sizeof("_model")-1, PHALCON_NOISY TSRMLS_CC); if (!zend_is_true(t0)) { PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_model_manager_ce); PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_modelsConfig", sizeof("_modelsConfig")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", t1, PHALCON_CHECK); PHALCON_CPY_WRT(model, i0); PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_modelsDir", sizeof("_modelsDir")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(model, "setmodelsdir", t2, PHALCON_NO_CHECK); phalcon_update_property_zval(this_ptr, "_model", strlen("_model"), model TSRMLS_CC); } PHALCON_ALLOC_ZVAL_MM(t3); phalcon_read_property(&t3, this_ptr, "_model", sizeof("_model")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_RETURN_CHECK_CTOR(t3); }
/** * Sets a Expires header to use HTTP cache * *<code> * $this->response->setExpires(new DateTime()); *</code> * * @param DateTime $datetime * @return Phalcon\Http\ResponseInterface */ PHP_METHOD(Phalcon_Http_Response, setExpires){ zval *datetime, *headers, *date, *utc_zone, *timezone; zval *format, *utc_format, *utc_date, *expires_header; zend_class_entry *ce0; PHALCON_MM_GROW(); phalcon_fetch_params(1, 1, 0, &datetime); if (Z_TYPE_P(datetime) != IS_OBJECT) { PHALCON_THROW_EXCEPTION_STR(phalcon_http_response_exception_ce, "datetime parameter must be an instance of DateTime"); return; } PHALCON_INIT_VAR(headers); PHALCON_CALL_METHOD(headers, this_ptr, "getheaders"); PHALCON_INIT_VAR(date); if (phalcon_clone(date, datetime TSRMLS_CC) == FAILURE) { return; } /** * All the expiration times are sent in UTC */ PHALCON_INIT_VAR(utc_zone); ZVAL_STRING(utc_zone, "UTC", 1); ce0 = zend_fetch_class(SL("DateTimeZone"), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); PHALCON_INIT_VAR(timezone); object_init_ex(timezone, ce0); if (phalcon_has_constructor(timezone TSRMLS_CC)) { PHALCON_CALL_METHOD_PARAMS_1_NORETURN(timezone, "__construct", utc_zone); } /** * Change the timezone to utc */ PHALCON_CALL_METHOD_PARAMS_1_NORETURN(date, "settimezone", timezone); PHALCON_INIT_VAR(format); ZVAL_STRING(format, "D, d M Y H:i:s", 1); PHALCON_INIT_VAR(utc_format); PHALCON_CALL_METHOD_PARAMS_1(utc_format, date, "format", format); PHALCON_INIT_VAR(utc_date); PHALCON_CONCAT_VS(utc_date, utc_format, " GMT"); /** * The 'Expires' header set this info */ PHALCON_INIT_VAR(expires_header); ZVAL_STRING(expires_header, "Expires", 1); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(this_ptr, "setheader", expires_header, utc_date); RETURN_THIS(); }
/** * Check whether internal resource has rows to fetch * * @return boolean */ PHP_METHOD(Phalcon_Model_Resultset, valid){ zval *result = NULL, *row = NULL, *rows = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL; zval *c0 = NULL, *c1 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_type", sizeof("_type")-1, PHALCON_NOISY TSRMLS_CC); if (zend_is_true(t0)) { PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_result", sizeof("_result")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(result, t1); if (Z_TYPE_P(result) != IS_BOOL || (Z_TYPE_P(result) == IS_BOOL && Z_BVAL_P(result))) { PHALCON_INIT_VAR(c0); ZVAL_LONG(c0, 1); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "setfetchmode", c0, PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_METHOD_PARAMS_1(r0, result, "fetcharray", result, PHALCON_NO_CHECK); PHALCON_CPY_WRT(row, r0); if (zend_is_true(row)) { PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_model", sizeof("_model")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_STATIC_PARAMS_2(r1, "phalcon_model_base", "dumpresult", t2, row); phalcon_update_property_zval(this_ptr, "_activeRow", strlen("_activeRow"), r1 TSRMLS_CC); PHALCON_MM_RESTORE(); RETURN_TRUE; } else { PHALCON_INIT_VAR(c1); ZVAL_LONG(c1, 2); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "setfetchmode", c1, PHALCON_NO_CHECK); } } } else { PHALCON_ALLOC_ZVAL_MM(t3); phalcon_read_property(&t3, this_ptr, "_rows", sizeof("_rows")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(rows, t3); PHALCON_ALLOC_ZVAL_MM(r2); Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1(r2, "current", rows, 0x054); Z_UNSET_ISREF_P(rows); PHALCON_CPY_WRT(row, r2); if (zend_is_true(row)) { Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("next", rows, 0x059); Z_UNSET_ISREF_P(rows); phalcon_update_property_zval(this_ptr, "_activeRow", strlen("_activeRow"), row TSRMLS_CC); PHALCON_MM_RESTORE(); RETURN_TRUE; } } PHALCON_MM_RESTORE(); RETURN_FALSE; }
/** * Sends SQL statements to the MySQL database server returning success state. * When the SQL sent have returned any row, the result is a PHP resource. * * * $resultset = $connection->query("SELECT * FROM robots WHERE type=?", array("mechanical")); * * @param string $sqlStatement * @return Phalcon_Db_Result_Mysql|boolean */ PHP_METHOD(Phalcon_Db_Adapter_Mysql, query){ zval *sql_statement = NULL, *id_connection = NULL, *result = NULL; zval *number_error = NULL, *error_message = NULL; zval *t0 = NULL; zval *i0 = NULL, *i1 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &sql_statement) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "_beforequery", sql_statement, PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, SL("_idConnection"), PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(id_connection, t0); PHALCON_INIT_VAR(result); PHALCON_CALL_FUNC_PARAMS_2(result, "mysqli_query", id_connection, sql_statement); if (zend_is_true(result)) { PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "_afterquery", sql_statement, PHALCON_NO_CHECK); if (Z_TYPE_P(result) == IS_OBJECT) { PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_db_result_mysql_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", result, PHALCON_CHECK); RETURN_CTOR(i0); } RETURN_CHECK_CTOR(result); } PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_METHOD(r0, this_ptr, "noerror", PHALCON_NO_CHECK); PHALCON_CPY_WRT(number_error, r0); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CONCAT_SVS(r2, " when executing \"", sql_statement, "\""); PHALCON_CALL_METHOD_PARAMS_1(r1, this_ptr, "error", r2, PHALCON_NO_CHECK); PHALCON_CPY_WRT(error_message, r1); PHALCON_ALLOC_ZVAL_MM(i1); object_init_ex(i1, phalcon_db_exception_ce); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(i1, "__construct", error_message, number_error, PHALCON_CHECK); phalcon_throw_exception(i1 TSRMLS_CC); return; }
/** * Phalcon_Acl Constructor * * @param string $adapterName * @param array $options */ PHP_METHOD(Phalcon_Acl, __construct){ zval *adapter_name = NULL, *options = NULL, *adapter_class = NULL; zval *a0 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL; zval *i0 = NULL, *i1 = NULL; zend_class_entry *ce0; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zz", &adapter_name, &options) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!adapter_name) { PHALCON_INIT_VAR(adapter_name); ZVAL_STRING(adapter_name, "Memory", 1); } if (!options) { PHALCON_INIT_VAR(a0); array_init(a0); PHALCON_CPY_WRT(options, a0); } PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CONCAT_SV(r0, "Phalcon_Acl_Adapter_", adapter_name); PHALCON_CPY_WRT(adapter_class, r0); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_CALL_FUNC_PARAMS_1(r1, "class_exists", adapter_class); if (!zend_is_true(r1)) { PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_acl_exception_ce); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CONCAT_SVS(r2, "Adapter '", adapter_name, "' does not exist"); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", r2, PHALCON_CHECK); phalcon_throw_exception(i0 TSRMLS_CC); return; } ce0 = phalcon_fetch_class(adapter_class TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(i1); object_init_ex(i1, ce0); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i1, "__construct", options, PHALCON_CHECK); phalcon_update_property_zval(this_ptr, SL("_adapter"), i1 TSRMLS_CC); PHALCON_MM_RESTORE(); }
/** * Phalcon_Model_MetaData constructor * * @param string $adapter * @param array $options */ PHP_METHOD(Phalcon_Model_MetaData, __construct){ zval *adapter = NULL, *options = NULL, *adapter_class = NULL, *adapter_object = NULL; zval *a0 = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL; zval *i0 = NULL, *i1 = NULL; zend_class_entry *ce0; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &adapter, &options) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!options) { PHALCON_INIT_VAR(a0); array_init(a0); PHALCON_CPY_WRT(options, a0); } PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CONCAT_SV(r0, "Phalcon_Model_MetaData_", adapter); PHALCON_CPY_WRT(adapter_class, r0); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_CALL_FUNC_PARAMS_1(r1, "class_exists", adapter_class); if (zend_is_true(r1)) { ce0 = phalcon_fetch_class(adapter_class TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, ce0); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", options, PHALCON_CHECK); PHALCON_CPY_WRT(adapter_object, i0); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CALL_METHOD(r2, adapter_object, "read", PHALCON_NO_CHECK); phalcon_update_property_zval(this_ptr, SL("_metaData"), r2 TSRMLS_CC); phalcon_update_property_zval(this_ptr, SL("_adapter"), adapter_object TSRMLS_CC); } else { PHALCON_ALLOC_ZVAL_MM(i1); object_init_ex(i1, phalcon_model_exception_ce); PHALCON_ALLOC_ZVAL_MM(r3); PHALCON_CONCAT_SVS(r3, "Meta-data adapter '", adapter, "' could not found"); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i1, "__construct", r3, PHALCON_CHECK); phalcon_throw_exception(i1 TSRMLS_CC); return; } PHALCON_MM_RESTORE(); }
/** * Phalcon_Backend_Adapter_File constructor * * @param mixed $frontendObject * @param array $backendOptions */ PHP_METHOD(Phalcon_Cache_Backend_File, __construct){ zval *frontend_object = NULL, *backend_options = NULL; zval *a0 = NULL; zval *r0 = NULL, *r1 = NULL; zval *i0 = NULL, *i1 = NULL; zval *c0 = NULL, *c1 = NULL; int eval_int; PHALCON_MM_GROW(); PHALCON_INIT_VAR(a0); array_init(a0); zend_update_property(phalcon_cache_backend_file_ce, this_ptr, "_backendOptions", strlen("_backendOptions"), a0 TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &frontend_object, &backend_options) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } phalcon_update_property_zval(this_ptr, "_frontendObject", strlen("_frontendObject"), frontend_object TSRMLS_CC); phalcon_update_property_zval(this_ptr, "_backendOptions", strlen("_backendOptions"), backend_options TSRMLS_CC); eval_int = phalcon_array_isset_string(backend_options, "cacheDir", strlen("cacheDir")+1); if (eval_int) { PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_ALLOC_ZVAL_MM(r1); phalcon_array_fetch_string(&r1, backend_options, "cacheDir", strlen("cacheDir"), PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_FUNC_PARAMS_1(r0, "is_writable", r1, 0x017); if (!zend_is_true(r0)) { PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_cache_exception_ce); PHALCON_INIT_VAR(c0); ZVAL_STRING(c0, "The cache directory does not exist or is not writable", 1); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", c0, PHALCON_CHECK); phalcon_throw_exception(i0 TSRMLS_CC); return; } } else { PHALCON_ALLOC_ZVAL_MM(i1); object_init_ex(i1, phalcon_cache_exception_ce); PHALCON_INIT_VAR(c1); ZVAL_STRING(c1, "You must specify the cache directory with the option cachesDir", 1); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i1, "__construct", c1, PHALCON_CHECK); phalcon_throw_exception(i1 TSRMLS_CC); return; } PHALCON_MM_RESTORE(); }
/** * Stops the active profile * * @access public */ PHP_METHOD(Phalcon_Db_Profiler, stopProfile){ zval *final_time = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL; zval *c0 = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL, *t5 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_INIT_VAR(c0); ZVAL_BOOL(c0, 1); PHALCON_CALL_FUNC_PARAMS_1(r0, "microtime", c0, 0x034); PHALCON_CPY_WRT(final_time, r0); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_activeProfile", sizeof("_activeProfile")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(t0, "setfinaltime", final_time, PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_totalSeconds", sizeof("_totalSeconds")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_activeProfile", sizeof("_activeProfile")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_METHOD(r1, t2, "getinitialtime", PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(r2); sub_function(r2, final_time, r1 TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(r3); phalcon_add_function(r3, t1, r2 TSRMLS_CC); phalcon_update_property_zval(this_ptr, "_totalSeconds", strlen("_totalSeconds"), r3 TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t3); phalcon_read_property(&t3, this_ptr, "_activeProfile", sizeof("_activeProfile")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t4); phalcon_read_property(&t4, this_ptr, "_allProfiles", sizeof("_allProfiles")-1, PHALCON_NOISY TSRMLS_CC); phalcon_array_append(&t4, t3, PHALCON_NO_SEPARATE_THX TSRMLS_CC); phalcon_update_property_zval(this_ptr, "_allProfiles", strlen("_allProfiles"), t4 TSRMLS_CC); if (phalcon_method_exists_ex(this_ptr, "afterendprofile", strlen("afterendprofile") TSRMLS_CC) == SUCCESS) { PHALCON_ALLOC_ZVAL_MM(t5); phalcon_read_property(&t5, this_ptr, "_activeProfile", sizeof("_activeProfile")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "afterendprofile", t5, PHALCON_NO_CHECK); } PHALCON_MM_RESTORE(); }
/** * Rewinds resultset to its beginning * */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, rewind){ zval *type = NULL, *result = NULL, *rows = NULL; zval *c0 = NULL; PHALCON_MM_GROW(); PHALCON_INIT_VAR(type); phalcon_read_property(&type, this_ptr, SL("_type"), PH_NOISY_CC); if (zend_is_true(type)) { PHALCON_INIT_VAR(result); phalcon_read_property(&result, this_ptr, SL("_result"), PH_NOISY_CC); if (Z_TYPE_P(result) != IS_BOOL || (Z_TYPE_P(result) == IS_BOOL && Z_BVAL_P(result))) { phalcon_update_property_long(this_ptr, SL("_pointer"), 1 TSRMLS_CC); PHALCON_INIT_VAR(c0); ZVAL_LONG(c0, 0); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "dataseek", c0, PH_NO_CHECK); } } else { PHALCON_INIT_VAR(rows); phalcon_read_property(&rows, this_ptr, SL("_rows"), PH_NOISY_CC); Z_SET_ISREF_P(rows); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("reset", rows); Z_UNSET_ISREF_P(rows); } PHALCON_MM_RESTORE(); }
/** * Get last row in the resultset * * @return Phalcon\Mvc\Model */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, getLast){ zval *count = NULL, *pre_count = NULL, *valid = NULL, *current = NULL; zval *t0 = NULL; PHALCON_MM_GROW(); PHALCON_INIT_VAR(count); PHALCON_CALL_METHOD(count, this_ptr, "count", PH_NO_CHECK); PHALCON_INIT_VAR(t0); ZVAL_LONG(t0, 1); PHALCON_INIT_VAR(pre_count); sub_function(pre_count, count, t0 TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "seek", pre_count, PH_NO_CHECK); PHALCON_INIT_VAR(valid); PHALCON_CALL_METHOD(valid, this_ptr, "valid", PH_NO_CHECK); if (Z_TYPE_P(valid) != IS_BOOL || (Z_TYPE_P(valid) == IS_BOOL && Z_BVAL_P(valid))) { PHALCON_INIT_VAR(current); PHALCON_CALL_METHOD(current, this_ptr, "current", PH_NO_CHECK); RETURN_CCTOR(current); } PHALCON_MM_RESTORE(); RETURN_FALSE; }
/** * Gets row in a specific position of the resultset * * @param int $index * @return Phalcon\Mvc\Model */ PHP_METHOD(Phalcon_Mvc_Model_Resultset, offsetGet){ zval *index = NULL, *count = NULL, *exists = NULL, *valid = NULL, *current = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(count); PHALCON_CALL_METHOD(count, this_ptr, "count", PH_NO_CHECK); PHALCON_INIT_VAR(exists); is_smaller_function(exists, index, count TSRMLS_CC); if (Z_TYPE_P(exists) == IS_BOOL && Z_BVAL_P(exists)) { PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "seek", index, PH_NO_CHECK); PHALCON_INIT_VAR(valid); PHALCON_CALL_METHOD(valid, this_ptr, "valid", PH_NO_CHECK); if (Z_TYPE_P(valid) != IS_BOOL || (Z_TYPE_P(valid) == IS_BOOL && Z_BVAL_P(valid))) { PHALCON_INIT_VAR(current); PHALCON_CALL_METHOD(current, this_ptr, "current", PH_NO_CHECK); RETURN_CCTOR(current); } else { PHALCON_MM_RESTORE(); RETURN_FALSE; } } PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_model_exception_ce, "The index does not exist in the cursor"); return; }
/** * Throws an internal exception * * @param Phalcon_Response $response * @param string $message */ PHP_METHOD(Phalcon_Dispatcher, _throwDispatchException){ zval *response = NULL, *message = NULL; zval *c0 = NULL, *c1 = NULL; zval *i0 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &response, &message) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(c0); ZVAL_LONG(c0, 404); PHALCON_INIT_VAR(c1); ZVAL_STRING(c1, "Not Found", 1); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(response, "setstatuscode", c0, c1, PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_dispatcher_exception_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", message, PHALCON_CHECK); phalcon_throw_exception(i0 TSRMLS_CC); return; }
/** * Returns the first row in a SQL query result * * @param string $sqlQuery * @param int $fetchMode * @return array */ PHP_METHOD(Phalcon_Db, fetchOne){ zval *sql_query = NULL, *fetch_mode = NULL, *result = NULL, *row = NULL, *empty_row = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z", &sql_query, &fetch_mode) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!fetch_mode) { PHALCON_ALLOC_ZVAL_MM(fetch_mode); ZVAL_LONG(fetch_mode, 2); } PHALCON_INIT_VAR(result); PHALCON_CALL_METHOD_PARAMS_1(result, this_ptr, "query", sql_query, PH_NO_CHECK); if (Z_TYPE_P(result) == IS_OBJECT) { PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "setfetchmode", fetch_mode, PH_NO_CHECK); PHALCON_INIT_VAR(row); PHALCON_CALL_METHOD(row, result, "fetcharray", PH_NO_CHECK); RETURN_CCTOR(row); } PHALCON_INIT_VAR(empty_row); array_init(empty_row); RETURN_CTOR(empty_row); }
/** * Sets transaction manager related to the transaction * * @param Phalcon\Mvc\Model\Transaction\Manager $manager */ PHP_METHOD(Phalcon_Mvc_Model_Transaction, setTransactionManager){ zval *manager = NULL; zval *i0 = NULL; zval *r0 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &manager) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (Z_TYPE_P(manager) != IS_OBJECT) { PHALCON_ALLOC_ZVAL_MM(i0); object_init_ex(i0, phalcon_mvc_model_transaction_exception_ce); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CONCAT_VS(r0, manager, " must be an Object"); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(i0, "__construct", r0, PH_CHECK); phalcon_throw_exception(i0 TSRMLS_CC); return; } phalcon_update_property_zval(this_ptr, SL("_manager"), manager TSRMLS_CC); PHALCON_MM_RESTORE(); }
/** * Rewinds resultset to its beginning * */ PHP_METHOD(Phalcon_Model_Resultset, rewind){ zval *result = NULL; zval *t0 = NULL, *t1 = NULL, *t2 = NULL; zval *c0 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, "_type", sizeof("_type")-1, PHALCON_NOISY TSRMLS_CC); if (zend_is_true(t0)) { PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, "_result", sizeof("_result")-1, PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(result, t1); if (Z_TYPE_P(result) != IS_BOOL || (Z_TYPE_P(result) == IS_BOOL && Z_BVAL_P(result))) { phalcon_update_property_long(this_ptr, "pointer", strlen("pointer"), 1 TSRMLS_CC); PHALCON_INIT_VAR(c0); ZVAL_LONG(c0, 0); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "dataseek", c0, PHALCON_NO_CHECK); } } else { PHALCON_ALLOC_ZVAL_MM(t2); phalcon_read_property(&t2, this_ptr, "_rows", sizeof("_rows")-1, PHALCON_NOISY TSRMLS_CC); Z_SET_ISREF_P(t2); PHALCON_CALL_FUNC_PARAMS_1_NORETURN("reset", t2, 0x055); Z_UNSET_ISREF_P(t2); } PHALCON_MM_RESTORE(); }
/** * Get last row in the resultset * * @return Phalcon_Model_Base */ PHP_METHOD(Phalcon_Model_Resultset, getLast){ zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL; zval *t0 = NULL; PHALCON_MM_GROW(); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_METHOD(r0, this_ptr, "count", PHALCON_NO_CHECK); PHALCON_INIT_VAR(t0); ZVAL_LONG(t0, 1); PHALCON_ALLOC_ZVAL_MM(r1); sub_function(r1, r0, t0 TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "seek", r1, PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CALL_METHOD(r2, this_ptr, "valid", PHALCON_NO_CHECK); if (Z_TYPE_P(r2) != IS_BOOL || (Z_TYPE_P(r2) == IS_BOOL && Z_BVAL_P(r2))) { PHALCON_ALLOC_ZVAL_MM(r3); PHALCON_CALL_METHOD(r3, this_ptr, "current", PHALCON_NO_CHECK); PHALCON_RETURN_DZVAL(r3); } PHALCON_MM_RESTORE(); RETURN_FALSE; }
/** * Phalcon\Mvc\Model\Resultset\Complex constructor * * @param array $columnsTypes * @param Phalcon\Db\ResultInterface $result * @param Phalcon\Cache\BackendInterface $cache */ PHP_METHOD(Phalcon_Mvc_Model_Resultset_Complex, __construct){ zval *columns_types, *result, *cache = NULL, *fetch_assoc; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|z", &columns_types, &result, &cache) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!cache) { PHALCON_INIT_NVAR(cache); } phalcon_update_property_zval(this_ptr, SL("_columnTypes"), columns_types TSRMLS_CC); phalcon_update_property_zval(this_ptr, SL("_result"), result TSRMLS_CC); phalcon_update_property_zval(this_ptr, SL("_cache"), cache TSRMLS_CC); phalcon_update_property_long(this_ptr, SL("_type"), 1 TSRMLS_CC); if (PHALCON_IS_NOT_FALSE(result)) { PHALCON_INIT_VAR(fetch_assoc); ZVAL_LONG(fetch_assoc, 1); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(result, "setfetchmode", fetch_assoc, PH_NO_CHECK); } PHALCON_MM_RESTORE(); }
/** * Adds a message to the session flasher * * @param string $type * @param string $message */ PHP_METHOD(Phalcon_Flash_Session, message){ zval *type, *message, *remove, *messages = NULL; zval *a0 = NULL; int eval_int; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &type, &message) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(remove); ZVAL_BOOL(remove, 0); PHALCON_INIT_VAR(messages); PHALCON_CALL_METHOD_PARAMS_1(messages, this_ptr, "_getsessionmessages", remove, PH_NO_CHECK); if (Z_TYPE_P(messages) != IS_ARRAY) { PHALCON_INIT_NVAR(messages); array_init(messages); } eval_int = phalcon_array_isset(messages, type); if (!eval_int) { PHALCON_INIT_VAR(a0); array_init(a0); phalcon_array_update_zval(&messages, type, &a0, PH_COPY | PH_SEPARATE TSRMLS_CC); } phalcon_array_update_append_multi_2(&messages, type, message, 0 TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "_setsessionmessages", messages, PH_NO_CHECK); PHALCON_MM_RESTORE(); }
/** * 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); }
/** * Returns the annotations found in the class docblock * * @return Phalcon\Annotations\Collection */ PHP_METHOD(Phalcon_Annotations_Reflection, getClassAnnotations){ zval *annotations, *reflection_data, *reflection_class; zval *collection; PHALCON_MM_GROW(); PHALCON_OBS_VAR(annotations); phalcon_read_property(&annotations, this_ptr, SL("_classAnnotations"), PH_NOISY_CC); if (Z_TYPE_P(annotations) != IS_OBJECT) { PHALCON_OBS_VAR(reflection_data); phalcon_read_property(&reflection_data, this_ptr, SL("_reflectionData"), PH_NOISY_CC); if (phalcon_array_isset_string(reflection_data, SS("class"))) { PHALCON_OBS_VAR(reflection_class); phalcon_array_fetch_string(&reflection_class, reflection_data, SL("class"), PH_NOISY_CC); PHALCON_INIT_VAR(collection); object_init_ex(collection, phalcon_annotations_collection_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(collection, "__construct", reflection_class); phalcon_update_property_zval(this_ptr, SL("_classAnnotations"), collection TSRMLS_CC); RETURN_CTOR(collection); } phalcon_update_property_bool(this_ptr, SL("_classAnnotations"), 0 TSRMLS_CC); RETURN_MM_FALSE; } RETURN_CCTOR(annotations); }
/** * Renders a view using the template engine * * @param string $path * @param array $params */ PHP_METHOD(Phalcon_View_Engine_Mustache, render){ zval *path = NULL, *params = NULL; zval *t0 = NULL, *t1 = NULL; zval *r0 = NULL, *r1 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &path, ¶ms) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } phalcon_update_property_zval(this_ptr, SL("_params"), params TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, SL("_view"), PHALCON_NOISY TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_ALLOC_ZVAL_MM(t1); phalcon_read_property(&t1, this_ptr, SL("_mustache"), PHALCON_NOISY TSRMLS_CC); PHALCON_ALLOC_ZVAL_MM(r1); PHALCON_CALL_FUNC_PARAMS_1(r1, "file_get_contents", path); PHALCON_CALL_METHOD_PARAMS_2(r0, t1, "render", r1, this_ptr, PHALCON_NO_CHECK); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(t0, "setcontent", r0, PHALCON_NO_CHECK); PHALCON_MM_RESTORE(); }
/** * Adds a message to the session flasher * * @param string $type * @param string $message */ PHP_METHOD(Phalcon_Flash_Session, message){ zval *type, *message, *remove, *messages = NULL; zval *a0 = NULL; PHALCON_MM_GROW(); phalcon_fetch_params(1, 2, 0, &type, &message); PHALCON_INIT_VAR(remove); ZVAL_BOOL(remove, 0); PHALCON_INIT_VAR(messages); PHALCON_CALL_METHOD_PARAMS_1(messages, this_ptr, "_getsessionmessages", remove); if (Z_TYPE_P(messages) != IS_ARRAY) { PHALCON_INIT_NVAR(messages); array_init(messages); } if (!phalcon_array_isset(messages, type)) { PHALCON_INIT_VAR(a0); array_init(a0); phalcon_array_update_zval(&messages, type, &a0, PH_COPY | PH_SEPARATE TSRMLS_CC); } phalcon_array_update_append_multi_2(&messages, type, message, 0 TSRMLS_CC); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "_setsessionmessages", messages); PHALCON_MM_RESTORE(); }
/** * Loads a model throwing an exception if it doesn't exist * * @return Phalcon\Mvc\Model */ PHP_METHOD(Phalcon_Mvc_Model_Manager, load){ zval *model_name = NULL, *model_exists = NULL, *model = NULL, *exception_message = NULL; zval *exception = NULL; zend_class_entry *ce0; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &model_name) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(model_exists); PHALCON_CALL_FUNC_PARAMS_1(model_exists, "class_exists", model_name); if (zend_is_true(model_exists)) { ce0 = phalcon_fetch_class(model_name TSRMLS_CC); PHALCON_INIT_VAR(model); object_init_ex(model, ce0); PHALCON_CALL_METHOD_NORETURN(model, "__construct", PH_CHECK); RETURN_CTOR(model); } PHALCON_INIT_VAR(exception_message); PHALCON_CONCAT_SVS(exception_message, "The model '", model_name, "' could not be loaded"); PHALCON_INIT_VAR(exception); object_init_ex(exception, phalcon_mvc_model_exception_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(exception, "__construct", exception_message, PH_CHECK); phalcon_throw_exception(exception TSRMLS_CC); return; }
/** * Adds a resource by its type * *<code> * $assets->addResourceByType('css', new Phalcon\Assets\Resource\Css('css/style.css')); *</code> * * @param string $type * @param Phalcon\Assets\Resource $resource * @return Phalcon\Assets\Manager */ PHP_METHOD(Phalcon_Assets_Manager, addResourceByType){ zval *type, *resource, *collections, *collection = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &type, &resource) == FAILURE) { RETURN_MM_NULL(); } PHALCON_OBS_VAR(collections); phalcon_read_property_this(&collections, this_ptr, SL("_collections"), PH_NOISY_CC); if (phalcon_array_isset(collections, type)) { PHALCON_OBS_VAR(collection); phalcon_array_fetch(&collection, collections, type, PH_NOISY_CC); } else { PHALCON_INIT_NVAR(collection); object_init_ex(collection, phalcon_assets_collection_ce); phalcon_update_property_array(this_ptr, SL("_collections"), type, collection TSRMLS_CC); } /** * Add the resource to the collection */ PHALCON_CALL_METHOD_PARAMS_1_NORETURN(collection, "add", resource); RETURN_THIS(); }
/** * Gets row in a specific position of the resultset * * @param int $index * @return Phalcon_Model_Base */ PHP_METHOD(Phalcon_Model_Resultset, offsetGet){ zval *index = NULL; zval *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &index) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_ALLOC_ZVAL_MM(r0); PHALCON_CALL_METHOD(r0, this_ptr, "count", PHALCON_NO_CHECK); PHALCON_INIT_VAR(r1); is_smaller_function(r1, index, r0 TSRMLS_CC); if (zend_is_true(r1)) { PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "seek", index, PHALCON_NO_CHECK); PHALCON_ALLOC_ZVAL_MM(r2); PHALCON_CALL_METHOD(r2, this_ptr, "valid", PHALCON_NO_CHECK); if (Z_TYPE_P(r2) != IS_BOOL || (Z_TYPE_P(r2) == IS_BOOL && Z_BVAL_P(r2))) { PHALCON_ALLOC_ZVAL_MM(r3); PHALCON_CALL_METHOD(r3, this_ptr, "current", PHALCON_NO_CHECK); PHALCON_RETURN_DZVAL(r3); } else { PHALCON_MM_RESTORE(); RETURN_FALSE; } } PHALCON_THROW_EXCEPTION_STR(phalcon_model_exception_ce, "The index does not exist in the cursor"); return; }
/** * Restores the state of a Phalcon\Annotations\Reflection variable export * * @return array $data */ PHP_METHOD(Phalcon_Annotations_Reflection, __set_state){ zval *data, *reflection_data, *reflection = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &data) == FAILURE) { RETURN_MM_NULL(); } if (Z_TYPE_P(data) == IS_ARRAY) { /** * Check for a '_reflectionData' in the array to build the Reflection */ if (phalcon_array_isset_string(data, SS("_reflectionData"))) { PHALCON_OBS_VAR(reflection_data); phalcon_array_fetch_string(&reflection_data, data, SL("_reflectionData"), PH_NOISY_CC); PHALCON_INIT_VAR(reflection); object_init_ex(reflection, phalcon_annotations_reflection_ce); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(reflection, "__construct", reflection_data); RETURN_CTOR(reflection); } } PHALCON_INIT_NVAR(reflection); object_init_ex(reflection, phalcon_annotations_reflection_ce); PHALCON_CALL_METHOD_NORETURN(reflection, "__construct"); RETURN_CTOR(reflection); }
/** * Sets the HTTP response code * *<code> * $response->setStatusCode(404, "Not Found"); *</code> * * @param int $code * @param string $message * @return Phalcon\Http\ResponseInterface */ PHP_METHOD(Phalcon_Http_Response, setStatusCode){ zval *code, *message, *headers, *header_value, *status_value; zval *status_header; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &code, &message) == FAILURE) { RETURN_MM_NULL(); } PHALCON_INIT_VAR(headers); PHALCON_CALL_METHOD(headers, this_ptr, "getheaders"); /** * We use HTTP/1.1 instead of HTTP/1.0 */ PHALCON_INIT_VAR(header_value); PHALCON_CONCAT_SVSV(header_value, "HTTP/1.1 ", code, " ", message); PHALCON_CALL_METHOD_PARAMS_1_NORETURN(headers, "setraw", header_value); /** * We also define a 'Status' header with the HTTP status */ PHALCON_INIT_VAR(status_value); PHALCON_CONCAT_VSV(status_value, code, " ", message); PHALCON_INIT_VAR(status_header); ZVAL_STRING(status_header, "Status", 1); PHALCON_CALL_METHOD_PARAMS_2_NORETURN(headers, "set", status_header, status_value); phalcon_update_property_zval(this_ptr, SL("_headers"), headers TSRMLS_CC); RETURN_THIS(); }
/** * Constructor for Phalcon_Db_Adapter_Mysql. This method does not should to be called directly. Use Phalcon_Db::factory instead * * @param stdClass $descriptor */ PHP_METHOD(Phalcon_Db_Adapter_Mysql, __construct){ zval *descriptor = NULL; zval *t0 = NULL; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &descriptor) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } if (!descriptor) { PHALCON_INIT_VAR(descriptor); ZVAL_NULL(descriptor); } else { PHALCON_SEPARATE_PARAM(descriptor); } if (!zend_is_true(descriptor)) { PHALCON_ALLOC_ZVAL_MM(t0); phalcon_read_property(&t0, this_ptr, SL("_descriptor"), PHALCON_NOISY TSRMLS_CC); PHALCON_CPY_WRT(descriptor, t0); } PHALCON_CALL_METHOD_PARAMS_1_NORETURN(this_ptr, "connect", descriptor, PHALCON_NO_CHECK); PHALCON_MM_RESTORE(); }