protected function oneOf($name, $conditions)
    {
        $method = 'get' . ucfirst($name);
        if (method_exists($this, $method)) {
            /** @var \yii\db\ActiveQuery $q */
            $q = call_user_func([$this, $method]);
            $q->andOnCondition($conditions);
            return $q->one();
        }
        throw new InvalidArgumentException(Yii::t('error', 'Method {method} not found.', compact('method')));
    }
protected function oneOf($name, $conditions)
    {
        $method = 'get' . ucfirst($name);
        if (method_exists($this, $method)) {
            /** @var \yii\db\ActiveQuery $q */
            $q = call_user_func([$this, $method]);
            $q->andOnCondition($conditions);
            return $q->one();
        }
        throw new InvalidArgumentException(Yii::t('error', 'Method {method} not found.', compact('method')));
    }
protected function oneOf ( $ name , $ conditions ) { $ method = 'get' . ucfirst ( $ name ) ; if ( method_exists ( $ this , $ method ) ) { /** @var \yii\db\ActiveQuery $q */ $ q = call_user_func ( [ $ this , $ method ] ) ; $ q -> andOnCondition ( $ conditions ) ; return $ q -> one ( ) ; } throw new InvalidArgumentException ( Yii :: t ( 'error' , 'Method {method} not found.' , compact ( 'method' ) ) ) ; }
"One of" functionality
@param string $name
@param array $conditions
@return array|null|ActiveRecord
@throws InvalidArgumentException
One of functionality