select('a.id', 'a.title', 'a.url') ->from('articles', 'a') ->where(Translation::coalesceTranslatedFields(ArticlesTranslation::class, ['figure', 'title', 'url'])) ->andWhere(Operator::equals(['a.show_in_search' => 'Y'])) ->andWhere('a.date < NOW()') ->having('figure="Y"') ->execute(); foreach ($articleList as $article) { $url = empty($article['url']) ? StringUtil::slugify($article['title']) : rtrim($article['url'], '/'); yield [ 'loc' => path('kupshop_content_articles_article_1', ['IDa' => $article['id'], 'slug' => $url], Router::ABSOLUTE_URL), 'priority' => '0.7', 'changefreq' => 'monthly', ]; } } }