Skip to content

Commit

Permalink
added option for registration of InvoiceFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
MartkCz committed Jun 13, 2017
1 parent d73285f commit 2193ee0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/DI/InvoiceExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use WebChemistry\Invoice\Data\Template;
use WebChemistry\Invoice\IFormatter;
use WebChemistry\Invoice\Invoice;
use WebChemistry\Invoice\InvoiceFactory;
use WebChemistry\Invoice\ITranslator;
use WebChemistry\Invoice\Translator;

Expand All @@ -27,7 +28,8 @@ class InvoiceExtension extends CompilerExtension {
'tin' => NULL,
'vaTin' => NULL,
],
'lang' => 'en'
'lang' => 'en',
'invoiceFactory' => FALSE,
];

public function loadConfiguration() {
Expand All @@ -54,6 +56,11 @@ public function loadConfiguration() {

$builder->addDefinition($this->prefix('invoice'))
->setClass(Invoice::class);

if ($config['invoiceFactory']) {
$builder->addDefinition($this->prefix('invoiceFactory'))
->setClass(InvoiceFactory::class);
}
}

}

0 comments on commit 2193ee0

Please sign in to comment.