Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

changed logic in function boot that all config parameters can be loaded #45

Merged
merged 1 commit into from
Jun 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions WhiteOctoberTCPDFBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ public function boot()
foreach ($config as $k => $v)
{
$constKey = strtoupper($k);

// All K_ constants are required
if (preg_match("/^k_/i", $k))

if (!defined($constKey))
{
if (!defined($constKey))
{
$value = $this->container->getParameterBag()->resolveValue($v);

$value = $this->container->getParameterBag()->resolveValue($v);

// All K_ constants are required
if (preg_match("/^k_/i", $k))
{

if (($k === 'k_path_cache' || $k === 'k_path_url_cache') && !is_dir($value)) {
$this->createDir($value);
}
Expand All @@ -45,14 +46,8 @@ public function boot()
$value .= (substr($value, -1) == '/' ? '' : '/');
}

define($constKey, $value);
}
}

// and one special value which TCPDF will use if present
if (strtolower($k) == "pdf_font_name_main" && !defined($constKey))
{
define($constKey, $v);
define($constKey, $value);
}
}
}
Expand Down