Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed fieldName to a protected method. Added todo discussing future…

… improvements needed.
  • Loading branch information...
commit 275e1bc1ac35e20f014525609c8106c1f2d1777b 1 parent 9e9945c
@nealerickson nealerickson authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 data/source/Database.php
View
8 data/source/Database.php
@@ -245,8 +245,12 @@ public function name($name) {
*
* @param string $field Field or identifier name.
* @return string Returns the field name without the table alias, if applicable.
+ * @todo Eventually, this should be refactored and moved to the Query or Schema
+ * class. Also, by handling field resolution in this way we are not handling
+ * cases where query conditions use the same field name in multiple tables.
+ * e.g. Foos.bar and Bars.bar will both return bar.
*/
- public function fieldName($field) {
+ protected function _fieldName($field) {
if (is_string($field)) {
if (preg_match('/^[a-z0-9_-]+\.[a-z0-9_-]+$/i', $field)) {
list($first, $second) = explode('.', $field, 2);
@@ -723,7 +727,7 @@ protected function _conditions($conditions, $context, array $options = array())
public function _processConditions($key, $value, $context, $schema, $glue = 'AND') {
$constraintTypes =& $this->_constraintTypes;
- $fieldMeta = $schema->fields($this->fieldName($key)) ?: array();
+ $fieldMeta = $schema->fields($this->_fieldName($key)) ?: array();
switch (true) {
case (is_numeric($key) && is_string($value)):
Please sign in to comment.
Something went wrong with that request. Please try again.