Files
kupshop/bundles/External/HannahBundle/Attachment/OCUserCardToUPartnerPDFAttachment.php
2025-08-02 16:30:27 +02:00

43 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace External\HannahBundle\Attachment;
use KupShop\KupShopBundle\Email\EmailGroupTypeEnum;
use KupShop\KupShopBundle\Util\System\PathFinder;
use KupShop\OrderingBundle\Attachment\BaseAttachment;
use KupShop\OrderingBundle\Exception\InvoiceException;
use Symfony\Contracts\Service\Attribute\Required;
class OCUserCardToUPartnerPDFAttachment extends BaseAttachment
{
protected static $name = '[OC] PDF Podmínky užití - PARTNER';
protected static $type = 'oc_user_card_tou_partner_pdf';
protected static $group = EmailGroupTypeEnum::OTHER;
protected static $priority = -10;
private PathFinder $pathFinder;
#[Required]
final public function setPathFinder(PathFinder $pathFinder): void
{
$this->pathFinder = $pathFinder;
}
public function getFilename(): string
{
return 'Zakaznicka_karta_Podminky_uziti.pdf';
}
public function getContent()
{
$path = $this->pathFinder->dataPath('files/email-attachment/karta_PARTNER.pdf');
if (!file_exists($path)) {
throw new InvoiceException('Cannot find source file: '.$path);
}
return file_get_contents($path);
}
}