Skip to content

Commit

Permalink
Merge pull request #1328 from sjinks/issue-1327
Browse files Browse the repository at this point in the history
[1.3.0] Fix #1327
  • Loading branch information
Phalcon committed Oct 4, 2013
2 parents f58df2a + bc5c651 commit 42a4f37
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
49 changes: 24 additions & 25 deletions ext/mvc/model/criteria.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, getDI){
* Set a model on which the query will be executed
*
* @param string $modelName
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, setModelName){

Expand Down Expand Up @@ -152,7 +152,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, getModelName){
* This method replaces all previously set bound parameters
*
* @param string $bindParams
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, bind){

Expand All @@ -174,7 +174,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, bind){
* This method replaces all previously set bound parameters
*
* @param string $bindTypes
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, bindTypes){

Expand All @@ -199,7 +199,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, bindTypes){
*</code>
*
* @param string|array $columns
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, columns){

Expand All @@ -225,7 +225,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, columns){
* @param string $conditions
* @param string $alias
* @param string $type
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, join){

Expand Down Expand Up @@ -291,8 +291,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, join){
* @param string $model
* @param string $conditions
* @param string $alias
* @param string $type
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, innerJoin){

Expand Down Expand Up @@ -354,7 +353,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, innerJoin){
* @param string $model
* @param string $conditions
* @param string $alias
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, leftJoin){

Expand Down Expand Up @@ -416,7 +415,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, leftJoin){
* @param string $model
* @param string $conditions
* @param string $alias
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, rightJoin){

Expand Down Expand Up @@ -474,7 +473,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, rightJoin){
* @param string $conditions
* @param array $bindParams
* @param array $bindTypes
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, where){

Expand Down Expand Up @@ -549,7 +548,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, where){
* @param string $conditions
* @param array $bindParams
* @param array $bindTypes
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, addWhere){

Expand Down Expand Up @@ -577,7 +576,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, addWhere){
* @param string $conditions
* @param array $bindParams
* @param array $bindTypes
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, andWhere){

Expand Down Expand Up @@ -666,7 +665,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, andWhere){
* @param string $conditions
* @param array $bindParams
* @param array $bindTypes
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, orWhere){

Expand Down Expand Up @@ -759,7 +758,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, orWhere){
* @param string $expr
* @param mixed $minimum
* @param mixed $maximum
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, betweenWhere){

Expand Down Expand Up @@ -820,7 +819,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, betweenWhere){
* @param string $expr
* @param mixed $minimum
* @param mixed $maximum
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, notBetweenWhere){

Expand Down Expand Up @@ -880,7 +879,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, notBetweenWhere){
*
* @param string $expr
* @param array $values
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, inWhere){

Expand Down Expand Up @@ -958,7 +957,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, inWhere){
*
* @param string $expr
* @param array $values
* @return Phalcon\Mvc\Model\Query\Builder
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, notInWhere){

Expand Down Expand Up @@ -1031,7 +1030,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, notInWhere){
* Adds the conditions parameter to the criteria
*
* @param string $conditions
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaIntreface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, conditions){

Expand All @@ -1052,7 +1051,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, conditions){
* Adds the order-by parameter to the criteria (deprecated)
*
* @param string $orderColumns
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, order){

Expand All @@ -1073,7 +1072,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, order){
* Adds the order-by parameter to the criteria
*
* @param string $orderColumns
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, orderBy){

Expand All @@ -1095,7 +1094,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, orderBy){
*
* @param int $limit
* @param int $offset
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, limit){

Expand Down Expand Up @@ -1130,7 +1129,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, limit){
* Adds the "for_update" parameter to the criteria
*
* @param boolean $forUpdate
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, forUpdate){

Expand All @@ -1150,7 +1149,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, forUpdate){
* Adds the "shared_lock" parameter to the criteria
*
* @param boolean $sharedLock
* @return Phalcon\Mvc\Model\Criteria
* @return Phalcon\Mvc\Model\CriteriaInterface
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, sharedLock){

Expand Down Expand Up @@ -1254,7 +1253,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, getOrder){
/**
* Returns all the parameters defined in the criteria
*
* @return string
* @return array
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, getParams){

Expand All @@ -1268,7 +1267,7 @@ PHP_METHOD(Phalcon_Mvc_Model_Criteria, getParams){
* @param Phalcon\DiInterface $dependencyInjector
* @param string $modelName
* @param array $data
* @return static
* @return Phalcon\Mvc\Model\Criteria
*/
PHP_METHOD(Phalcon_Mvc_Model_Criteria, fromInput){

Expand Down
9 changes: 8 additions & 1 deletion ext/mvc/model/query/builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ PHALCON_INIT_CLASS(Phalcon_Mvc_Model_Query_Builder){
PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, __construct){

zval *params = NULL, *dependency_injector = NULL, *conditions = NULL;
zval *models, *columns, *group_clause;
zval *models, *columns, *group_clause, *joins;
zval *having_clause, *order_clause, *limit_clause;
zval *offset_clause, *for_update, *shared_lock;
zval *limit, *offset;
Expand Down Expand Up @@ -145,6 +145,13 @@ PHP_METHOD(Phalcon_Mvc_Model_Query_Builder, __construct){
if (phalcon_array_isset_string_fetch(&columns, params, SS("columns"))) {
phalcon_update_property_this(this_ptr, SL("_columns"), columns TSRMLS_CC);
}

/**
* Assign JOIN clause
*/
if (phalcon_array_isset_string_fetch(&joins, params, SS("joins"))) {
phalcon_update_property_this(this_ptr, SL("_joins"), joins TSRMLS_CC);
}

/**
* Assign GROUP clause
Expand Down

0 comments on commit 42a4f37

Please sign in to comment.