public static function getByAttribute($attribute, $value, $asArray = false)
    {
        if (isset(self::$uniqueAttributeToId[$attribute][$value])) {
            return static::getById(self::$uniqueAttributeToId[$attribute][$value], $asArray);
        }
        $row = static::find()
            ->where([$attribute => $value])
            ->asArray($asArray)
            ->one();
        static::addRowToMap($row);
        return $row;
    }