thought it was agreed not to add removeCondition to keep models safe?!

Janis Volbergs
Senior Web Developer with 13y+ experience
Agile Toolkit add-on factory: http://demo.ambienttech.lv/
Make sure to follow me on twitter: http://twitter.com/ambienttech_lv



On Sep 11, 2013, at 10:59 PM, Imants Horsts <notifications@github.com> wrote:

> In lib/SQL/Model.php:
> 
> > @@ -307,6 +307,19 @@ function addCondition($field,$cond=undefined,$value=undefined){
> >          }
> >          return $this;
> >      }
> > +    /** Removes "WHERE" condition, but tries to be smart about where and how the field is defined */
> > +    function removeCondition($field,$kind='where',$system=false,$editable=true){
> > +        // get model field object
> > +        if(!$field instanceof Field){
> > +            $field=$this->getElement($field);
> > +        }
> > +        foreach($this->_dsql()->args[$kind] as $k=>$v){
> > +            if ($v[0]==$this->table.'.'.$field->short_name){
> > +                unset($this->_dsql()->args[$kind][$k]);
> > +            }
> > +        }
> > +        $this->getElement($field->short_name)->system($system)->editable($editable);
> Can't there be simply $field instead of $this->getElement($field->shortname) ?
> 
> —
> Reply to this email directly or view it on GitHub.
> 
>