I ran into a problem while generating multiple docx files at the same time. If I apply a template with the addTemplate() method, it will be applied to whatever object is rendered first through createDocx, even if that is a different object. This makes working with multiple CreateDocx objects somewhat risky. Is this a bug, or is there a method I could use to avoid this issue?
The following code demonstrates the issue:
// create two objects
$a = new CreateDocx();
$b = new CreateDocx();
// add a template to file a
$a->addTemplate('template.docx');
// render file b, it will contain the template that was added to file a
$b->createDocx('b');
// next render file a, which will not contain the template
$a->createDocx('a');