_restAlias || !preg_match("/^receipt\-([\d]+)\.pdf$/", $this->_restAlias, $matches)) { $this->_do404(); } $taxationId = $matches[1]; if (!($taxation = $this->_getDataObj()->setPrimaryKey($taxationId)->getData())) { $this->_do404(); } $renderer = new ReceiptRenderer(); $file = constant('WWW_PATH') . '/' . constant('CURRENT_PAGE'); $output = constant('DEBUG'); $pdf = $renderer->render($taxation, $file, $output); if (!$output) { $pdf->send(basename($file), true); } exit; } public static function getFileTypePage($type, $field = null) { return Qs_SiteMap::findFirst([], ['type' => 'Taxation\\Pdf\\', 'fileType' => $type], [], $field); } private static function getFileUrl($type, $id) { return self::getFileTypePage($type, 'url') . "/{$type}-{$id}.pdf"; } public static function getReceiptUrl($id) { return self::getFileUrl(self::TYPE_RECEIPT, $id); } }