Skip to content

Enables flexible JOIN. #32

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

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 18 additions & 0 deletions NotORM/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class NotORM_Result extends NotORM_Abstract implements Iterator, ArrayAccess, Co
protected $select = array(), $conditions = array(), $where = array(), $parameters = array(), $order = array(), $limit = null, $offset = null, $group = "", $having = "", $lock = null;
protected $union = array(), $unionOrder = array(), $unionLimit = null, $unionOffset = null;
protected $data, $referencing = array(), $aggregation = array(), $accessed, $access, $keys = array();
protected $customizedJoins = array();

/** Create table result
* @param string
Expand Down Expand Up @@ -104,9 +105,26 @@ protected function createJoins($val) {
}
}
}

if(count($this->customizedJoins) > 0) {
foreach($this->customizedJoins as $name=>$query) {
$return[$name] = " ".$query;
}
}

return $return;
}

/** Flexible JOIN
* @param string table to JOIN
* @param string JOIN part
* @return string SQL query
**/
function join($tableName, $joinQuery) {
$this->customizedJoins[$tableName] = $joinQuery;
return $this;
}

/** Get SQL query
* @return string
*/
Expand Down