/**
* @return Shopware_Components_TemplateMail
*/
public function factory(Container
$container) { $container->
load('mailtransport'
);
$stringCompiler =
new Shopware_Components_StringCompiler( $container->
get(Enlight_Template_Manager::
class) );
$mailer =
new Shopware_Components_TemplateMail();
if ($container->
initialized('shop'
)) { $shop =
$container->
get('shop'
);
if (!
$shop instanceof Shop
) { throw new RuntimeException('Shop object not found in DI container'
);
} $mailer->
setShop($shop);
} $mailer->
setModelManager($container->
get(ModelManager::
class));
$mailer->
setStringCompiler($stringCompiler);
return $mailer;
}