summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authorIgor Moiseev <[email protected]>2013-10-24 00:56:22 +0200
committerSimon Holywell <[email protected]>2014-04-26 13:45:46 +0100
commitde29638b4891c47b6293a52b76d146675fbcd012 (patch)
tree40eab82d3ea6673b9ba203fc8adcc9f955391c04 /idiorm.php
parent73f00fd6966570357196e0da51cf933490d230c3 (diff)
Add a RAW JOIN source to the query
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/idiorm.php b/idiorm.php
index e4d7cae..4ab91bc 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -947,6 +947,28 @@
}
/**
+ * Add a RAW JOIN source to the query
+ */
+ public function raw_join($table, $constraint, $table_alias=null) {
+ // Add table alias if present
+ if (!is_null($table_alias)) {
+ $table_alias = $this->_quote_identifier($table_alias);
+ $table .= " {$table_alias}";
+ }
+
+ // Build the constraint
+ if (is_array($constraint)) {
+ list($first_column, $operator, $second_column) = $constraint;
+ $first_column = $this->_quote_identifier($first_column);
+ $second_column = $this->_quote_identifier($second_column);
+ $constraint = "{$first_column} {$operator} {$second_column}";
+ }
+
+ $this->_join_sources[] = "{$table} ON {$constraint}";
+ return $this;
+ }
+
+ /**
* Add a simple JOIN source to the query
*/
public function join($table, $constraint, $table_alias=null) {