Skip to content

Commit

Permalink
Avoiding multiple initialization of models
Browse files Browse the repository at this point in the history
  • Loading branch information
phalcon committed Jun 30, 2012
1 parent 2f73a51 commit c6062f9
Show file tree
Hide file tree
Showing 31 changed files with 1,059 additions and 783 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ before_script:
- mysql -uroot -e 'create database phalcon_test charset=utf8 collate=utf8_unicode_ci;'
- mysql -uroot phalcon_test < unit-tests/schemas/mysql/phalcon_test.sql
- psql -c 'create database phalcon_test;' -U postgres
- psql -U postgres phalcon_test -f unit-tests/schemas/postgresql/phalcon_test.sql
- psql -U postgres phalcon_test -q -f unit-tests/schemas/postgresql/phalcon_test.sql
- chmod +x unit-tests/ci/run_script.sh

script: sudo ./unit-tests/ci/run_script.sh
Expand Down
3 changes: 2 additions & 1 deletion dev/controller/front.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ PHP_METHOD(Phalcon_Controller_Front, setControllersDir){

/**
* Sets models directory. Depending of your platform, always add a trailing slash or backslash
*
*
*
*
* @param string $modelsDir
Expand Down Expand Up @@ -710,6 +710,7 @@ PHP_METHOD(Phalcon_Controller_Front, dispatchLoop){
PHALCON_ALLOC_ZVAL_MM(r10);
PHALCON_CALL_METHOD(r10, view, "getcontent", PHALCON_NO_CHECK);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(response, "setcontent", r10, PHALCON_NO_CHECK);
PHALCON_CALL_METHOD_NORETURN(response, "sendheaders", PHALCON_NO_CHECK);

RETURN_CHECK_CTOR(response);
}
Expand Down
54 changes: 26 additions & 28 deletions dev/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,10 @@ PHP_METHOD(Phalcon_Db, delete){
}

/**
* Starts a transaction in the connection
*
* @return boolean
*/
* Starts a transaction in the connection
*
* @return boolean
*/
PHP_METHOD(Phalcon_Db, begin){

zval *r0 = NULL;
Expand All @@ -610,10 +610,10 @@ PHP_METHOD(Phalcon_Db, begin){
}

/**
* Rollbacks the active transaction in the connection
*
* @return boolean
*/
* Rollbacks the active transaction in the connection
*
* @return boolean
*/
PHP_METHOD(Phalcon_Db, rollback){

zval *t0 = NULL;
Expand Down Expand Up @@ -642,10 +642,10 @@ PHP_METHOD(Phalcon_Db, rollback){
}

/**
* Commits the active transaction in the connection
*
* @return boolean
*/
* Commits the active transaction in the connection
*
* @return boolean
*/
PHP_METHOD(Phalcon_Db, commit){

zval *t0 = NULL;
Expand Down Expand Up @@ -827,7 +827,7 @@ PHP_METHOD(Phalcon_Db, getUsername){

/**
* Returns the username which has connected to the database
*
*
* @return string
*/
PHP_METHOD(Phalcon_Db, getHostName){
Expand Down Expand Up @@ -861,10 +861,10 @@ PHP_METHOD(Phalcon_Db, getHostName){
*/
PHP_METHOD(Phalcon_Db, _beforeQuery){

zval *sql_statement = NULL;
zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL;
zval *sql_statement = NULL, *logger = NULL, *profiler = NULL;
zval *t0 = NULL, *t1 = NULL;
zval *r0 = NULL, *r1 = NULL;
zval *c0 = NULL;
zval *c0 = NULL, *c1 = NULL;

PHALCON_MM_GROW();

Expand All @@ -875,26 +875,24 @@ PHP_METHOD(Phalcon_Db, _beforeQuery){

PHALCON_ALLOC_ZVAL_MM(t0);
phalcon_read_property(&t0, this_ptr, SL("_logger"), PHALCON_NOISY TSRMLS_CC);
if (zend_is_true(t0)) {
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_read_property(&t1, this_ptr, SL("_logger"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(logger, t0);
if (zend_is_true(logger)) {
PHALCON_ALLOC_ZVAL_MM(r0);
PHALCON_ALLOC_ZVAL_MM(r1);
PHALCON_INIT_VAR(c0);
ZVAL_BOOL(c0, 1);
PHALCON_CALL_METHOD_PARAMS_1(r1, this_ptr, "getconnectionid", c0, PHALCON_NO_CHECK);
PHALCON_CONCAT_SVSV(r0, "[", r1, "] ", sql_statement);
PHALCON_ALLOC_ZVAL_MM(t2);
phalcon_get_class_constant(t2, phalcon_logger_ce, SL("DEBUG") TSRMLS_CC);
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(t1, "log", r0, t2, PHALCON_NO_CHECK);
PHALCON_INIT_VAR(c1);
ZVAL_LONG(c1, 7);
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(logger, "log", r0, c1, PHALCON_NO_CHECK);
}

PHALCON_ALLOC_ZVAL_MM(t3);
phalcon_read_property(&t3, this_ptr, SL("_profiler"), PHALCON_NOISY TSRMLS_CC);
if (zend_is_true(t3)) {
PHALCON_ALLOC_ZVAL_MM(t4);
phalcon_read_property(&t4, this_ptr, SL("_profiler"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(t4, "startprofile", sql_statement, PHALCON_NO_CHECK);
PHALCON_ALLOC_ZVAL_MM(t1);
phalcon_read_property(&t1, this_ptr, SL("_profiler"), PHALCON_NOISY TSRMLS_CC);
PHALCON_CPY_WRT(profiler, t1);
if (zend_is_true(profiler)) {
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(profiler, "startprofile", sql_statement, PHALCON_NO_CHECK);
}

PHALCON_MM_RESTORE();
Expand Down
2 changes: 1 addition & 1 deletion dev/db/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ PHP_METHOD(Phalcon_Db_Pool, setDefaultDescriptor){
*
*
* @param boolean $newConnection
* @param boolean $renovate
* @param boolean $renovate
* @return Phalcon_Db
*/
PHP_METHOD(Phalcon_Db_Pool, getConnection){
Expand Down
2 changes: 1 addition & 1 deletion dev/db/profiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ PHP_METHOD(Phalcon_Db_Profiler, stopProfile){
}

/**
* Returns the total number of SQL statements processed
* Returns the total number of SQL statements processed
*
* @return integer
*/
Expand Down
18 changes: 9 additions & 9 deletions dev/dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ PHP_METHOD(Phalcon_Dispatcher, getBasePath){

/**
* Sets the default controller name
*
*
* @param string $controllerName
*/
PHP_METHOD(Phalcon_Dispatcher, setDefaultController){
Expand All @@ -162,7 +162,7 @@ PHP_METHOD(Phalcon_Dispatcher, setDefaultController){

/**
* Sets the default action name
*
*
* @param string $actionName
*/
PHP_METHOD(Phalcon_Dispatcher, setDefaultAction){
Expand Down Expand Up @@ -294,9 +294,9 @@ PHP_METHOD(Phalcon_Dispatcher, getParams){

/**
* Set a param by its name or numeric index
*
* @param mixed $param
* @param mixed $value
*
* @param mixed $param
* @param mixed $value
*/
PHP_METHOD(Phalcon_Dispatcher, setParam){

Expand All @@ -320,8 +320,8 @@ PHP_METHOD(Phalcon_Dispatcher, setParam){

/**
* Gets a param by its name or numeric index
*
* @param mixed $param
*
* @param mixed $param
* @return mixed
*/
PHP_METHOD(Phalcon_Dispatcher, getParam){
Expand Down Expand Up @@ -760,7 +760,7 @@ PHP_METHOD(Phalcon_Dispatcher, getControllers){
}

/**
* Returns last dispatched controller
* Returns the lastest dispatched controller
*
* @return Phalcon_Controller
*/
Expand All @@ -776,7 +776,7 @@ PHP_METHOD(Phalcon_Dispatcher, getLastController){
}

/**
* Returns value returned by last dispacthed action
* Returns value returned by the lastest dispatched action
*
* @return mixed
*/
Expand Down
2 changes: 1 addition & 1 deletion dev/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ PHP_METHOD(Phalcon_Flash, error){
/**
* Shows a HTML notice/information message
*
*
*
*
* @param string $message
* @param string $classes
Expand Down
Loading

0 comments on commit c6062f9

Please sign in to comment.