summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {