-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Ciao Ale scusa il disturbo.
Abbiamo aggiornato l'applicazione per lavorare esclusivamente con un Filesystem Bucket,
Ci siamo accorti che possiamo passare solamente il contenuto del file e NON la dir.
Esempio funsione load() in FileSdIBase per invio fatture:
/**
* Load Signed Invoice from Bucket
*/
$fileSdI->load(Storage::get($signdir));
$response = new RispostaSdIRiceviFile($client->RiceviFile($fileSdI));
la funzione GET ci ritorna il contenuto di un file nel Bucket 'PRIVATE': non accessibile.
Ma nella funzione load() file_get_contents ovviamente non può essere instanziato.
public function load( $invoice )
{
if ($invoice instanceOf \Taocomp\Einvoicing\AbstractDocument) {
$this->NomeFile = $invoice->getFilename();
$this->File = $invoice->asXML();
} else if (true === is_readable($invoice)) {
$this->NomeFile = basename($invoice);
$this->File = file_get_contents($invoice);
$this->removeBOM();
} else {
throw new \Exception("Invalid file or object '$invoice'");
}
return $this;
}
Anche noi abbiamo dovuto modificare delle librerie perchè non possono più accedere ai file direttamente.
ora, Come facciamo ? Io posso anche modificare la classe, ma le modifiche le perderei all'aggiornamento.
Potresti aggiungere per esempio loadContents() ???
Io l'ho dovuta aggiungere manualmente in DUE FILE:
- FileSdI.php
/**
* @param $filename
* @param $filecontents
* @return $this|FileSdIBase
* @throws \Exception
*/
public function loadContents($filename, $filecontents)
{
parent::loadContents($filename, $filecontents);
$xml = simplexml_load_string($filecontents);
if (!$xml->IdentificativoSdI) {
throw new \Exception("Cannot find 'IdentificativoSdI' File Contents");
}
$this->IdentificativoSdI = $xml->IdentificativoSdI;
return $this;
}
- FileSdIBase.php
/**
* @param $filename
* @param $filecontents
* @return $this
* @throws \Exception
*/
public function loadContents($filename, $filecontents)
{
$this->NomeFile = $filename;
$this->File = $filecontents;
$this->removeBOM();
return $this;
}
Ovviamente se l'aggiungi, magari su tutte le funzioni che richiedono una dir file di avere anche la possibilità di passare direttamente anche il contenuto. 😘😘
Aspetto tue, Salutissimi!