Test fixes

This commit is contained in:
Dennis Eichhorn 2022-12-24 20:22:28 +01:00
parent f5c666e97a
commit 7609e25a52
5 changed files with 48 additions and 4 deletions

View File

@ -41,8 +41,11 @@ trait ExchangeTrait
*/ */
public function exchangeFromRequest(RequestAbstract $request) : array public function exchangeFromRequest(RequestAbstract $request) : array
{ {
/** @var \Modules\Exchange\Models\ExhcangeSetting $setting */ /** @var \Modules\Exchange\Models\ExchangeSetting $setting */
$setting = ExchangeSettingMapper::get()->where('id', (int) $request->getData('setting'))->execute(); $setting = ExchangeSettingMapper::get()
->where('id', (int) $request->getData('setting'))
->execute();
$settingData = $setting->getData(); $settingData = $setting->getData();
$lang = []; $lang = [];
@ -73,7 +76,8 @@ trait ExchangeTrait
] ]
); );
foreach (($setting['relation'] ?? []) as $table) { $relations = $setting->getRelations();
foreach ($relations as $table) {
$importQuery = new Builder($importConnection); $importQuery = new Builder($importConnection);
$importQuery->from($table['src']); $importQuery->from($table['src']);

View File

@ -75,6 +75,11 @@
"type": "TEXT", "type": "TEXT",
"null": false "null": false
}, },
"exchange_settings_relations": {
"name": "exchange_settings_relations",
"type": "TEXT",
"null": false
},
"exchange_settings_job": { "exchange_settings_job": {
"name": "exchange_settings_job", "name": "exchange_settings_job",
"type": "INT", "type": "INT",

View File

@ -42,6 +42,14 @@ class ExchangeSetting implements \JsonSerializable
*/ */
public string $title = ''; public string $title = '';
/**
* Relation definitions between tables/columns.
*
* @var array
* @since 1.0.0
*/
private array $relations = [];
/** /**
* Data. * Data.
* *
@ -104,6 +112,32 @@ class ExchangeSetting implements \JsonSerializable
return $this->id; return $this->id;
} }
/**
* Set relations
*
* @param array $relations Relations between tables/columsn
*
* @return void
*
* @since 1.0.0
*/
public function setRelations(array $relations) : void
{
$this->relations = $relations;
}
/**
* Get table/column relations
*
* @return array
*
* @since 1.0.0
*/
public function getRelations() : array
{
return $this->relations;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -36,6 +36,7 @@ final class ExchangeSettingMapper extends DataMapperFactory
'exchange_settings_id' => ['name' => 'exchange_settings_id', 'type' => 'int', 'internal' => 'id'], 'exchange_settings_id' => ['name' => 'exchange_settings_id', 'type' => 'int', 'internal' => 'id'],
'exchange_settings_title' => ['name' => 'exchange_settings_title', 'type' => 'string', 'internal' => 'title'], 'exchange_settings_title' => ['name' => 'exchange_settings_title', 'type' => 'string', 'internal' => 'title'],
'exchange_settings_data' => ['name' => 'exchange_settings_data', 'type' => 'Json', 'internal' => 'data'], 'exchange_settings_data' => ['name' => 'exchange_settings_data', 'type' => 'Json', 'internal' => 'data'],
'exchange_settings_relations' => ['name' => 'exchange_settings_relations', 'type' => 'Json', 'internal' => 'relations'],
'exchange_settings_job' => ['name' => 'exchange_settings_job', 'type' => 'int', 'internal' => 'job'], 'exchange_settings_job' => ['name' => 'exchange_settings_job', 'type' => 'int', 'internal' => 'job'],
'exchange_settings_exchange' => ['name' => 'exchange_settings_exchange', 'type' => 'int', 'internal' => 'exchange'], 'exchange_settings_exchange' => ['name' => 'exchange_settings_exchange', 'type' => 'int', 'internal' => 'exchange'],
]; ];

View File

@ -130,7 +130,7 @@ class InterfaceManager
public function __construct(string $path = '') public function __construct(string $path = '')
{ {
$this->path = $path; $this->path = $path;
$this->account = new NullAccount(); $this->createdBy = new NullAccount();
$this->createdAt = new \DateTimeImmutable(); $this->createdAt = new \DateTimeImmutable();
$this->source = new NullCollection(); $this->source = new NullCollection();
} }