Skip to content

Commit

Permalink
Fixed belongs_to/has_many record where conditions to parse placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
David McReynolds committed Oct 7, 2014
1 parent e87fb3b commit 0c026a5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fuel/modules/fuel/core/MY_Model.php
Expand Up @@ -2733,7 +2733,7 @@ public function form_fields($values = array(), $related = array())
if (!empty($val['where']))
{
$where = $val['where'];
$where = $this->_replace_placeholders($where, $values);
$where = self::replace_placeholders($where, $values);
unset($val['where']);
}
if (!empty($val['order']))
Expand Down Expand Up @@ -2789,7 +2789,7 @@ public function form_fields($values = array(), $related = array())
if (!empty($rel_config['where']))
{
$where = $rel_config['where'];
$where = $this->_replace_placeholders($where, $values);
$where = self::replace_placeholders($where, $values);
}

if (!empty($rel_config['order']))
Expand All @@ -2814,7 +2814,7 @@ public function form_fields($values = array(), $related = array())
if (!empty($rel_config['where']))
{
$where = $rel_config['where'];
$where = $this->_replace_placeholders($where, $values);
$where = self::replace_placeholders($where, $values);
}

if (!empty($rel_config['order']))
Expand Down Expand Up @@ -4137,7 +4137,7 @@ protected function _is_nested_array($record)
* @param mixed
* @return boolean
*/
protected function _replace_placeholders($str, $values)
public static function replace_placeholders($str, $values)
{
if (is_string($str))
{
Expand Down Expand Up @@ -5547,7 +5547,7 @@ protected function _get_relationship($var, $return_object = FALSE, $relationship
{
if (! empty($rel_config['where']))
{
$this->_CI->$foreign_model->db()->where($rel_config['where']);
$this->_CI->$foreign_model->db()->where(MY_Model::replace_placeholders($rel_config['where'], $this->values()));
}

if (! empty($rel_config['order']))
Expand Down

0 comments on commit 0c026a5

Please sign in to comment.