Answer the question
In order to leave comments, you need to log in
How to get cacheDir in an arbitrary class?
I inherited an old bundle with the Excel class, which writes data to a file through PhpOffice\PhpSpreadsheet.
It has the following constructor:
public function __construct(array $options = [])
{
$this->cachePath = sys_get_temp_dir().'/excel/excel'.random_int(0, 100000);
Settings::setCache(new Psr16Cache(new FilesystemAdapter(
basename($this->cachePath), 3600, \dirname($this->cachePath)
)));
...
$document = new Excel($options);
$this->cachePath = 'var/cache/prod/'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question