public function loadBy($field, $value)
    {
        // store
        $field = $this->getField($field);
        $system = $field->system;
        $default = $field->default;

        // add condition and load record
        $this->addCondition($field, $value);

        try {
            $this->loadAny();
        } catch (\Exception $e) {
            // restore
            array_pop($this->conditions);
            $field->system = $system;
            $field->default = $default;

            throw $e;
        }

        // restore
        array_pop($this->conditions);
        $field->system = $system;
        $field->default = $default;

        return $this;
    }
public function loadBy($field, $value)
    {
        // store
        $field = $this->getField($field);
        $system = $field->system;
        $default = $field->default;

        // add condition and load record
        $this->addCondition($field, $value);

        try {
            $this->loadAny();
        } catch (\Exception $e) {
            // restore
            array_pop($this->conditions);
            $field->system = $system;
            $field->default = $default;

            throw $e;
        }

        // restore
        array_pop($this->conditions);
        $field->system = $system;
        $field->default = $default;

        return $this;
    }
public function loadBy ( $ field , $ value ) { // store $ field = $ this -> getField ( $ field ) ; $ system = $ field -> system ; $ default = $ field -> default ; // add condition and load record $ this -> addCondition ( $ field , $ value ) ; try { $ this -> loadAny ( ) ; } catch ( \ Exception $ e ) { // restore array_pop ( $ this -> conditions ) ; $ field -> system = $ system ; $ field -> default = $ default ; throw $ e ; } // restore array_pop ( $ this -> conditions ) ; $ field -> system = $ system ; $ field -> default = $ default ; return $ this ; }
Load record by condition.

@param mixed $field
@param mixed $value

@return $this
Load record by condition .