Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1529 #1565

Merged
merged 3 commits into from Nov 18, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions ext/cli/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,8 @@ PHP_METHOD(Phalcon_CLI_Console, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_cli_console_exception_ce, "Dependency Injector is invalid");
return;
}
PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_cli_console_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/cli/router.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ PHP_METHOD(Phalcon_CLI_Router, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_cli_router_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/db/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,8 @@ PHP_METHOD(Phalcon_Db_Adapter, setDialect){
zval *dialect;

phalcon_fetch_params(0, 1, 0, &dialect);

PHALCON_VERIFY_INTERFACE_EX(dialect, phalcon_db_dialectinterface_ce, phalcon_db_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dialect"), dialect TSRMLS_CC);

}

/**
Expand Down
13 changes: 5 additions & 8 deletions ext/di/injectable.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,16 @@ PHALCON_INIT_CLASS(Phalcon_DI_Injectable){
* Sets the dependency injector
*
* @param Phalcon\DiInterface $dependencyInjector
* @throw Phalcon\Di\Exception if !($dependencyInjector instanceof Phalcon\DiInterface)
*/
PHP_METHOD(Phalcon_DI_Injectable, setDI){

zval *dependency_injector;
zval **dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_di_exception_ce, "Dependency Injector is invalid");
return;
}
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);
phalcon_fetch_params_ex(1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(*dependency_injector, phalcon_diinterface_ce, phalcon_di_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), *dependency_injector TSRMLS_CC);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ PHP_METHOD(Phalcon_Dispatcher, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/flash/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ PHP_METHOD(Phalcon_Flash_Session, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_session_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/http/cookie.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ PHP_METHOD(Phalcon_Http_Cookie, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_http_cookie_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/http/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ PHP_METHOD(Phalcon_Http_Request, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_http_request_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/http/response.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ PHP_METHOD(Phalcon_Http_Response, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_http_response_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/http/response/cookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ PHP_METHOD(Phalcon_Http_Response_Cookies, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_http_response_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
3 changes: 1 addition & 2 deletions ext/mvc/collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ PHP_METHOD(Phalcon_Mvc_Collection, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_mvc_collection_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
7 changes: 1 addition & 6 deletions ext/mvc/collection/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,8 @@ PHP_METHOD(Phalcon_Mvc_Collection_Manager, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, "The dependency injector is invalid");
return;
}
PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_mvc_model_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
6 changes: 1 addition & 5 deletions ext/mvc/micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,7 @@ PHP_METHOD(Phalcon_Mvc_Micro, setDI){
PHALCON_MM_GROW();

phalcon_fetch_params(1, 1, 0, &dependency_injector);

if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STR(phalcon_mvc_application_exception_ce, "The dependency injector must be an object");
return;
}
PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_mvc_micro_exception_ce, 1);

/**
* We automatically set ourselves as application service
Expand Down
3 changes: 1 addition & 2 deletions ext/mvc/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,8 @@ PHP_METHOD(Phalcon_Mvc_Model, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_mvc_model_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
7 changes: 1 addition & 6 deletions ext/mvc/model/criteria.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,8 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, "Dependency Injector is invalid");
return;
}
PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_mvc_model_exception_ce, 0);
phalcon_update_property_array_string(this_ptr, SL("_params"), SS("di"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
7 changes: 1 addition & 6 deletions ext/mvc/model/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,8 @@ PHP_METHOD(Phalcon_Mvc_Model_Manager, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, "The dependency injector is invalid");
return;
}
PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_mvc_model_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
7 changes: 1 addition & 6 deletions ext/mvc/model/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,8 @@ PHP_METHOD(Phalcon_Mvc_Model_MetaData, setDI){
zval *dependency_injector;

phalcon_fetch_params(0, 1, 0, &dependency_injector);

if (Z_TYPE_P(dependency_injector) != IS_OBJECT) {
PHALCON_THROW_EXCEPTION_STRW(phalcon_mvc_model_exception_ce, "The dependency injector is invalid");
return;
}
PHALCON_VERIFY_INTERFACE_EX(dependency_injector, phalcon_diinterface_ce, phalcon_mvc_model_exception_ce, 0);
phalcon_update_property_this(this_ptr, SL("_dependencyInjector"), dependency_injector TSRMLS_CC);

}

/**
Expand Down
Loading