Skip to content

Commit c6062f9

Browse files
author
phalcon
committed
Avoiding multiple initialization of models
1 parent 2f73a51 commit c6062f9

31 files changed

+1059
-783
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ before_script:
2929
- mysql -uroot -e 'create database phalcon_test charset=utf8 collate=utf8_unicode_ci;'
3030
- mysql -uroot phalcon_test < unit-tests/schemas/mysql/phalcon_test.sql
3131
- psql -c 'create database phalcon_test;' -U postgres
32-
- psql -U postgres phalcon_test -f unit-tests/schemas/postgresql/phalcon_test.sql
32+
- psql -U postgres phalcon_test -q -f unit-tests/schemas/postgresql/phalcon_test.sql
3333
- chmod +x unit-tests/ci/run_script.sh
3434

3535
script: sudo ./unit-tests/ci/run_script.sh

dev/controller/front.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ PHP_METHOD(Phalcon_Controller_Front, setControllersDir){
193193

194194
/**
195195
* Sets models directory. Depending of your platform, always add a trailing slash or backslash
196-
*
196+
*
197197
*
198198
*
199199
* @param string $modelsDir
@@ -710,6 +710,7 @@ PHP_METHOD(Phalcon_Controller_Front, dispatchLoop){
710710
PHALCON_ALLOC_ZVAL_MM(r10);
711711
PHALCON_CALL_METHOD(r10, view, "getcontent", PHALCON_NO_CHECK);
712712
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(response, "setcontent", r10, PHALCON_NO_CHECK);
713+
PHALCON_CALL_METHOD_NORETURN(response, "sendheaders", PHALCON_NO_CHECK);
713714

714715
RETURN_CHECK_CTOR(response);
715716
}

dev/db.c

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,10 @@ PHP_METHOD(Phalcon_Db, delete){
588588
}
589589

590590
/**
591-
* Starts a transaction in the connection
592-
*
593-
* @return boolean
594-
*/
591+
* Starts a transaction in the connection
592+
*
593+
* @return boolean
594+
*/
595595
PHP_METHOD(Phalcon_Db, begin){
596596

597597
zval *r0 = NULL;
@@ -610,10 +610,10 @@ PHP_METHOD(Phalcon_Db, begin){
610610
}
611611

612612
/**
613-
* Rollbacks the active transaction in the connection
614-
*
615-
* @return boolean
616-
*/
613+
* Rollbacks the active transaction in the connection
614+
*
615+
* @return boolean
616+
*/
617617
PHP_METHOD(Phalcon_Db, rollback){
618618

619619
zval *t0 = NULL;
@@ -642,10 +642,10 @@ PHP_METHOD(Phalcon_Db, rollback){
642642
}
643643

644644
/**
645-
* Commits the active transaction in the connection
646-
*
647-
* @return boolean
648-
*/
645+
* Commits the active transaction in the connection
646+
*
647+
* @return boolean
648+
*/
649649
PHP_METHOD(Phalcon_Db, commit){
650650

651651
zval *t0 = NULL;
@@ -827,7 +827,7 @@ PHP_METHOD(Phalcon_Db, getUsername){
827827

828828
/**
829829
* Returns the username which has connected to the database
830-
*
830+
*
831831
* @return string
832832
*/
833833
PHP_METHOD(Phalcon_Db, getHostName){
@@ -861,10 +861,10 @@ PHP_METHOD(Phalcon_Db, getHostName){
861861
*/
862862
PHP_METHOD(Phalcon_Db, _beforeQuery){
863863

864-
zval *sql_statement = NULL;
865-
zval *t0 = NULL, *t1 = NULL, *t2 = NULL, *t3 = NULL, *t4 = NULL;
864+
zval *sql_statement = NULL, *logger = NULL, *profiler = NULL;
865+
zval *t0 = NULL, *t1 = NULL;
866866
zval *r0 = NULL, *r1 = NULL;
867-
zval *c0 = NULL;
867+
zval *c0 = NULL, *c1 = NULL;
868868

869869
PHALCON_MM_GROW();
870870

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

876876
PHALCON_ALLOC_ZVAL_MM(t0);
877877
phalcon_read_property(&t0, this_ptr, SL("_logger"), PHALCON_NOISY TSRMLS_CC);
878-
if (zend_is_true(t0)) {
879-
PHALCON_ALLOC_ZVAL_MM(t1);
880-
phalcon_read_property(&t1, this_ptr, SL("_logger"), PHALCON_NOISY TSRMLS_CC);
878+
PHALCON_CPY_WRT(logger, t0);
879+
if (zend_is_true(logger)) {
881880
PHALCON_ALLOC_ZVAL_MM(r0);
882881
PHALCON_ALLOC_ZVAL_MM(r1);
883882
PHALCON_INIT_VAR(c0);
884883
ZVAL_BOOL(c0, 1);
885884
PHALCON_CALL_METHOD_PARAMS_1(r1, this_ptr, "getconnectionid", c0, PHALCON_NO_CHECK);
886885
PHALCON_CONCAT_SVSV(r0, "[", r1, "] ", sql_statement);
887-
PHALCON_ALLOC_ZVAL_MM(t2);
888-
phalcon_get_class_constant(t2, phalcon_logger_ce, SL("DEBUG") TSRMLS_CC);
889-
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(t1, "log", r0, t2, PHALCON_NO_CHECK);
886+
PHALCON_INIT_VAR(c1);
887+
ZVAL_LONG(c1, 7);
888+
PHALCON_CALL_METHOD_PARAMS_2_NORETURN(logger, "log", r0, c1, PHALCON_NO_CHECK);
890889
}
891890

892-
PHALCON_ALLOC_ZVAL_MM(t3);
893-
phalcon_read_property(&t3, this_ptr, SL("_profiler"), PHALCON_NOISY TSRMLS_CC);
894-
if (zend_is_true(t3)) {
895-
PHALCON_ALLOC_ZVAL_MM(t4);
896-
phalcon_read_property(&t4, this_ptr, SL("_profiler"), PHALCON_NOISY TSRMLS_CC);
897-
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(t4, "startprofile", sql_statement, PHALCON_NO_CHECK);
891+
PHALCON_ALLOC_ZVAL_MM(t1);
892+
phalcon_read_property(&t1, this_ptr, SL("_profiler"), PHALCON_NOISY TSRMLS_CC);
893+
PHALCON_CPY_WRT(profiler, t1);
894+
if (zend_is_true(profiler)) {
895+
PHALCON_CALL_METHOD_PARAMS_1_NORETURN(profiler, "startprofile", sql_statement, PHALCON_NO_CHECK);
898896
}
899897

900898
PHALCON_MM_RESTORE();

dev/db/pool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ PHP_METHOD(Phalcon_Db_Pool, setDefaultDescriptor){
136136
*
137137
*
138138
* @param boolean $newConnection
139-
* @param boolean $renovate
139+
* @param boolean $renovate
140140
* @return Phalcon_Db
141141
*/
142142
PHP_METHOD(Phalcon_Db_Pool, getConnection){

dev/db/profiler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ PHP_METHOD(Phalcon_Db_Profiler, stopProfile){
162162
}
163163

164164
/**
165-
* Returns the total number of SQL statements processed
165+
* Returns the total number of SQL statements processed
166166
*
167167
* @return integer
168168
*/

dev/dispatcher.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ PHP_METHOD(Phalcon_Dispatcher, getBasePath){
141141

142142
/**
143143
* Sets the default controller name
144-
*
144+
*
145145
* @param string $controllerName
146146
*/
147147
PHP_METHOD(Phalcon_Dispatcher, setDefaultController){
@@ -162,7 +162,7 @@ PHP_METHOD(Phalcon_Dispatcher, setDefaultController){
162162

163163
/**
164164
* Sets the default action name
165-
*
165+
*
166166
* @param string $actionName
167167
*/
168168
PHP_METHOD(Phalcon_Dispatcher, setDefaultAction){
@@ -294,9 +294,9 @@ PHP_METHOD(Phalcon_Dispatcher, getParams){
294294

295295
/**
296296
* Set a param by its name or numeric index
297-
*
298-
* @param mixed $param
299-
* @param mixed $value
297+
*
298+
* @param mixed $param
299+
* @param mixed $value
300300
*/
301301
PHP_METHOD(Phalcon_Dispatcher, setParam){
302302

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

321321
/**
322322
* Gets a param by its name or numeric index
323-
*
324-
* @param mixed $param
323+
*
324+
* @param mixed $param
325325
* @return mixed
326326
*/
327327
PHP_METHOD(Phalcon_Dispatcher, getParam){
@@ -760,7 +760,7 @@ PHP_METHOD(Phalcon_Dispatcher, getControllers){
760760
}
761761

762762
/**
763-
* Returns last dispatched controller
763+
* Returns the lastest dispatched controller
764764
*
765765
* @return Phalcon_Controller
766766
*/
@@ -776,7 +776,7 @@ PHP_METHOD(Phalcon_Dispatcher, getLastController){
776776
}
777777

778778
/**
779-
* Returns value returned by last dispacthed action
779+
* Returns value returned by the lastest dispatched action
780780
*
781781
* @return mixed
782782
*/

dev/flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ PHP_METHOD(Phalcon_Flash, error){
135135
/**
136136
* Shows a HTML notice/information message
137137
*
138-
*
138+
*
139139
*
140140
* @param string $message
141141
* @param string $classes

0 commit comments

Comments
 (0)