generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace pagopa\database\sherlock; | ||
|
||
use pagopa\database\SingleRow; | ||
use Illuminate\Database\Capsule\Manager as Capsule; | ||
|
||
class ExtraInfo extends SingleRow | ||
{ | ||
|
||
/** | ||
* Chiavi primarie della tabella TRANSACTION | ||
* @var array|string[] | ||
*/ | ||
protected array $primary_keys = ['id', 'date_event']; | ||
|
||
/** | ||
* Solo date event è sufficiente per le insert | ||
* @var array | ||
*/ | ||
protected array $need_primary_keys = ['date_event']; | ||
|
||
|
||
public function __construct(\DateTime $date, array $eventData = []) | ||
{ | ||
$table = sprintf(EXTRA_INFO_TABLE, $date->format('Y')); | ||
parent::__construct($table, $eventData, ['id', 'date_event'], ['date_event']); | ||
} | ||
|
||
|
||
/** | ||
* Configura la inserted timestamp | ||
* @param \DateTime $date | ||
* @return $this | ||
*/ | ||
public function setInsertedTimestamp(\DateTime $date) : self | ||
{ | ||
$this->setNewColumnValue('inserted_timestamp', $date->format('Y-m-d H:i:s.v')); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Configura l'id del pagamento | ||
* @param string $fk_payment | ||
* @return $this | ||
*/ | ||
public function setFkPayment(string $fk_payment) : self | ||
{ | ||
$this->setNewColumnValue('fk_payment', $fk_payment); | ||
return $this; | ||
} | ||
|
||
/** | ||
* Configura il metadata | ||
* @param string $key | ||
* @param string $value | ||
* @return $this | ||
*/ | ||
public function setMetaData(string $key, string $value) : self | ||
{ | ||
$this->setNewColumnValue('meta_key', $key); | ||
$this->setNewColumnValue('meta_value', $value); | ||
return $this; | ||
} | ||
} |