use Shopware\Components\Routing\Context;
use Shopware\Models\Shop\Shop;
class Shopware_Controllers_Frontend_RobotsTxt extends Enlight_Controller_Action
{ /**
* @return void
*/
public function indexAction() { $shop =
$this->
get('shop'
);
$routerContexts =
$this->
getRouterContext($shop->
getMain() ?:
$shop);
$baseUrls =
array_map(static function DContext
$context) { return $context->
getBaseUrl();
},
$routerContexts);
$robotsTxtGenerator =
$this->
get(RobotsTxtGeneratorInterface::
class);
$baseUrls =
array_unique($baseUrls);
$robotsTxtGenerator->
setRouterContext($routerContexts);
$robotsTxtGenerator->
setBaseUrls($baseUrls);
$robotsTxtGenerator->
setHost($shop->
getHost());