Created
January 7, 2016 16:39
-
-
Save marceloandrader/bc6c8ec61f18d26e3343 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/API/Entity.php b/src/API/Entity.php | |
index 45721dc..eacacf8 100644 | |
--- a/src/API/Entity.php | |
+++ b/src/API/Entity.php | |
@@ -439,7 +439,7 @@ class Entity extends \Phalcon\DI\Injectable | |
// but can we do this with out breaking everything? | |
if ($relation->getType() == 0 or $relation->getType() == 1) { | |
// create both sides of the join | |
- $left = $alias . '.' . $relation->getReferencedFields(); | |
+ $left = '[' . $alias . '].' . $relation->getReferencedFields(); | |
$right = $modelNameSpace . $this->model->getModelName() . '.' . $relation->getFields(); | |
// create and alias join | |
$query->leftJoin($referencedModel, "$left = $right", $alias); | |
@@ -447,7 +447,7 @@ class Entity extends \Phalcon\DI\Injectable | |
// add all parent AND hasOne joins to the column list | |
if ($relation->getType() == 1) { | |
- $columns[] = "$alias.*"; | |
+ $columns[] = "[$alias].*"; | |
} | |
} | |
$query->columns($columns); | |
@@ -630,7 +630,7 @@ class Entity extends \Phalcon\DI\Injectable | |
// prepend modelNameSpace if the field is detected in the selected model's column map | |
foreach ($colMap as $field) { | |
if ($fieldName == $field) { | |
- return "$alias.$fieldName"; | |
+ return "[$alias].$fieldName"; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment