Search first item by field value

@param   string $column
@param   mixed  $value

@return  Aoe_Scheduler_Model_Job|null
778372
public function getItemByColumnValue($column, $value)
    {
        foreach ($this as $item) {
            /** @var Aoe_Scheduler_Model_Job $item */
            if ($item->getDataUsingMethod($column) == $value) {
                return $item;
            }
        }
        return null;
    }
145933
protected function first($model, $column, $value)
    {
        $data = $model::where($column, '=', $value);

        if (!is_null($data)) {
            if (count($data) > 0) {
                return $data[0];
            }
        }
    }
962409
public function findBy($columns, $value = null)
    {
        $this->loadAll();

        if (!is_array($columns)) {
            $columns = array($columns => $value);
        }

        $result = array();
        foreach ($this->allUnits as $u) {
            $status = true;
            foreach ($columns as $column => $value) {
                $unitValue = call_user_func(array($u, 'get'.ucfirst($column)));
                $status &= is_array($value) ? in_array($unitValue, $value) : $unitValue == $value;
            }
            if ($status) {
                $result[] = $u;
            }
        }

        return $result;
    }
470241
public function findAllBy($attribute, $value, $columns = ['*'])
    {
        return $this->model->where($attribute, '=', $value)->get($columns);
    }
660754
public function where($column, $value = null)
    {
        // If the column is an array, we will assume it is an array of key-value pairs
        // and can add them each as a where clause.
        if (is_array($column)) {
            return $this->whereNested(function ($query) use ($column) {
                foreach ($column as $key => $value) {
                    $query->where($key, $value);
                }
            });
        }

        $this->wheres[] = compact('column', 'value');

        return $this;
    }
591791
public function findBy($field, $value)
    {
        $model_class = $this->getModelName();
        return $model_class::where($field, $value)->first();
    }
89744
public static function dropDown($column, $value = null)
    {
        $dropDownList = [
            "status" => [
                UrlRule::STATUS_ACTIVE => Yii::t('system', 'Active'),
                UrlRule::STATUS_PASSIVE => Yii::t('system', 'Disable'),
            ],
            "redirect_code" => [
                "301" => "301",
                "302" => "302",
            ],
        ];
        //根据具体值显示对应的值
        if ($value !== null) {
            return array_key_exists($column, $dropDownList) ? $dropDownList[$column][$value] : false;
        } else {//返回关联数组，用户下拉的filter实现
            return array_key_exists($column, $dropDownList) ? $dropDownList[$column] : false;
        }
    }
289060
public static function dropDown($column, $value = null)
    {
        $dropDownList = [
            "status" => [
                Authentication::STATUS_PENDING => Yii::t('authentication', 'Pending review'),
                Authentication::STATUS_REJECTED => Yii::t('authentication', 'Rejected'),
                Authentication::STATUS_AUTHENTICATED => Yii::t('authentication', 'Authenticated'),
            ],
        ];
        //根据具体值显示对应的值
        if ($value !== null) {
            return array_key_exists($column, $dropDownList) ? $dropDownList[$column][$value] : false;
        } else {//返回关联数组，用户下拉的filter实现
            return array_key_exists($column, $dropDownList) ? $dropDownList[$column] : false;
        }
    }
757561
public function value($column)
    {
        $result = (array) $this->first([$column]);

        return count($result) > 0 ? reset($result) : null;
    }
417735
public function orWhereTime($column, $operator, $value = null)
    {
        [$value, $operator] = $this->prepareValueAndOperator(
            $value, $operator, func_num_args() === 2
        );

        return $this->whereTime($column, $operator, $value, 'or');
    }
255859
public function value($column)
    {
        $result = $this->getBuilder()->value($column);

        // Reset query builder
        $this->resetBuilder();

        return $result;
    }
267884
public static function where($column, $operator, $value = null)
    {
        list($operator, $value) = static::prepareOperatorAndValue(
            $operator, $value, func_num_args() === 2
        );

        return new ValueConstraint($column, $operator, $value);
    }
616861
public function find($value, array $options = array(), $field = 'sku')
    {
        $options = array_replace(array(
            'includes' => array('images', 'categories', 'options', 'translations'),
        ), $options);

        $query = $this->newQuery($options);
        $query->where($field, '=', $value);

        return $query->firstOrFail();
    }
595589
public function first( $columns = ['*'] )
	{
		$results = $this->take( 1 )->get( $columns );

		return count( $results ) > 0 ? reset( $results ) : null;
	}
830785
public function orWhere($column, $operator = null, $value = null)
    {
        [$value, $operator] = $this->prepareValueAndOperator(
            $value, $operator, func_num_args() === 2
        );

        return $this->where($column, $operator, $value, 'or');
    }
140086
public function lte($column, $value = null)
    {
        return $this->where($column, $value, Cmp::LTE);
    }
949847
public function _and($column, $value = null) {
        if (!is_array($column)) {
            $column = array($column => $value);
        }

        $this->query['where'][count($this->query['where']) - 1] = array_merge(
            $this->query['where'][count($this->query['where']) - 1],
            $column
        );

        return $this;
    }