Merge branch 'new_protocol' of ssh://**REDACTED**/~/php/cakePHP/gradido_community_server into new_protocol

This commit is contained in:
Dario Rekowski on RockPI 2020-12-10 07:47:52 +00:00 committed by Ulf Gebhardt
commit 730f44c61b
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
13 changed files with 168 additions and 116 deletions

View File

@ -63,7 +63,7 @@ class JsonRpcRequestClientComponent extends Component
//$responseType = $response->getType(); //$responseType = $response->getType();
return ['state' => 'error', 'type' => 'request error', 'msg' => 'server response isn\'t valid json']; return ['state' => 'error', 'type' => 'request error', 'msg' => 'server response isn\'t valid json'];
} }
return $json; return $json['result'];
//return ['state' => 'success', 'data' => $json]; //return ['state' => 'success', 'data' => $json];
} }

View File

@ -80,12 +80,18 @@ class JsonRequestHandlerController extends AppController {
if(!$last_transaction_query->isEmpty()) { if(!$last_transaction_query->isEmpty()) {
$last_transaction_id = $last_transaction_query->first()->id; $last_transaction_id = $last_transaction_query->first()->id;
} }
if($last_transaction_query->count() < $last_transaction_id) {
$last_transaction_id = $last_transaction_query->count();
}
$group_alias = Configure::read('GroupAlias'); $group_alias = Configure::read('GroupAlias');
$result = (array)$this->JsonRpcRequestClient->request('getTransactions', ['groupAlias' => $group_alias, 'lastKnownSequenceNumber' => $last_transaction_id]); $result = $this->JsonRpcRequestClient->request('getTransactions', ['groupAlias' => $group_alias, 'lastKnownSequenceNumber' => $last_transaction_id]);
if(isset($result['state']) && $result['state'] == 'error') { if(isset($result['state']) && $result['state'] == 'error') {
return $this->returnJson(['state' => 'error', 'msg' => 'jsonrpc error', 'details' => $result]); return $this->returnJson(['state' => 'error', 'msg' => 'jsonrpc error', 'details' => $result]);
} }
if(!isset($result['transaction_count']) || $result['transaction_count'] == 0) {
return $this->returnJson(['state' => 'success']);
}
/* example /* example
$result = json_decode("[ $result = json_decode("[
{ {
@ -222,7 +228,12 @@ class JsonRequestHandlerController extends AppController {
$part_count = -1; $part_count = -1;
$temp_record = new Record; $temp_record = new Record;
$errors = []; $errors = [];
foreach($result as $_record) {
foreach($result['blocks'] as $_record) {
if(is_string($_record)) {
// if it is a string, it is block validation hash in hex
continue;
}
$parse_result = $temp_record->parseRecord($_record); $parse_result = $temp_record->parseRecord($_record);
if($parse_result == true) { if($parse_result == true) {
$sequenceNumber = $temp_record->getSequenceNumber(); $sequenceNumber = $temp_record->getSequenceNumber();

View File

@ -20,7 +20,7 @@ class StateGroupAddressesController extends AppController
public function index() public function index()
{ {
$this->paginate = [ $this->paginate = [
'contain' => ['StateGroups', 'AddressTypes'] 'contain' => ['AddressTypes'],
]; ];
$stateGroupAddresses = $this->paginate($this->StateGroupAddresses); $stateGroupAddresses = $this->paginate($this->StateGroupAddresses);
@ -37,7 +37,7 @@ class StateGroupAddressesController extends AppController
public function view($id = null) public function view($id = null)
{ {
$stateGroupAddress = $this->StateGroupAddresses->get($id, [ $stateGroupAddress = $this->StateGroupAddresses->get($id, [
'contain' => ['StateGroups', 'AddressTypes'] 'contain' => ['StateGroups', 'AddressTypes'],
]); ]);
$this->set('stateGroupAddress', $stateGroupAddress); $this->set('stateGroupAddress', $stateGroupAddress);
@ -75,7 +75,7 @@ class StateGroupAddressesController extends AppController
public function edit($id = null) public function edit($id = null)
{ {
$stateGroupAddress = $this->StateGroupAddresses->get($id, [ $stateGroupAddress = $this->StateGroupAddresses->get($id, [
'contain' => [] 'contain' => [],
]); ]);
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$stateGroupAddress = $this->StateGroupAddresses->patchEntity($stateGroupAddress, $this->request->getData()); $stateGroupAddress = $this->StateGroupAddresses->patchEntity($stateGroupAddress, $this->request->getData());

View File

@ -7,7 +7,7 @@ use Cake\ORM\Entity;
* StateGroupAddress Entity * StateGroupAddress Entity
* *
* @property int $id * @property int $id
* @property int $state_group_id * @property int $group_id
* @property string|resource $public_key * @property string|resource $public_key
* @property int $address_type_id * @property int $address_type_id
* *
@ -26,10 +26,10 @@ class StateGroupAddress extends Entity
* @var array * @var array
*/ */
protected $_accessible = [ protected $_accessible = [
'state_group_id' => true, 'group_id' => true,
'public_key' => true, 'public_key' => true,
'address_type_id' => true, 'address_type_id' => true,
'state_group' => true, 'state_group' => true,
'address_type' => true 'address_type' => true,
]; ];
} }

View File

@ -9,7 +9,7 @@ use Cake\Validation\Validator;
/** /**
* StateGroupAddresses Model * StateGroupAddresses Model
* *
* @property \App\Model\Table\StateGroupsTable&\Cake\ORM\Association\BelongsTo $StateGroups * @property &\Cake\ORM\Association\BelongsTo $Groups
* @property \App\Model\Table\AddressTypesTable&\Cake\ORM\Association\BelongsTo $AddressTypes * @property \App\Model\Table\AddressTypesTable&\Cake\ORM\Association\BelongsTo $AddressTypes
* *
* @method \App\Model\Entity\StateGroupAddress get($primaryKey, $options = []) * @method \App\Model\Entity\StateGroupAddress get($primaryKey, $options = [])
@ -37,13 +37,13 @@ class StateGroupAddressesTable extends Table
$this->setDisplayField('id'); $this->setDisplayField('id');
$this->setPrimaryKey('id'); $this->setPrimaryKey('id');
$this->belongsTo('StateGroups', [ /*$this->belongsTo('Groups', [
'foreignKey' => 'state_group_id', 'foreignKey' => 'group_id',
'joinType' => 'INNER' 'joinType' => 'INNER',
]); ]);*/
$this->belongsTo('AddressTypes', [ $this->belongsTo('AddressTypes', [
'foreignKey' => 'address_type_id', 'foreignKey' => 'address_type_id',
'joinType' => 'INNER' 'joinType' => 'INNER',
]); ]);
} }
@ -56,12 +56,13 @@ class StateGroupAddressesTable extends Table
public function validationDefault(Validator $validator) public function validationDefault(Validator $validator)
{ {
$validator $validator
->integer('id') ->nonNegativeInteger('id')
->allowEmptyString('id', null, 'create'); ->allowEmptyString('id', null, 'create');
$validator $validator
->requirePresence('public_key', 'create') ->requirePresence('public_key', 'create')
->notEmptyString('public_key'); ->notEmptyString('public_key')
->add('public_key', 'unique', ['rule' => 'validateUnique', 'provider' => 'table']);
return $validator; return $validator;
} }
@ -75,7 +76,8 @@ class StateGroupAddressesTable extends Table
*/ */
public function buildRules(RulesChecker $rules) public function buildRules(RulesChecker $rules)
{ {
$rules->add($rules->existsIn(['state_group_id'], 'StateGroups')); $rules->add($rules->isUnique(['public_key']));
//$rules->add($rules->existsIn(['group_id'], 'Groups'));
$rules->add($rules->existsIn(['address_type_id'], 'AddressTypes')); $rules->add($rules->existsIn(['address_type_id'], 'AddressTypes'));
return $rules; return $rules;

View File

@ -61,16 +61,36 @@ class GradidoModifieUserBalance
public function getUserId($userPublicKey) public function getUserId($userPublicKey)
{ {
$userPublicBin = hex2bin($userPublicKey);
$stateUsersTable = TableRegistry::getTableLocator()->get('StateUsers'); $stateUsersTable = TableRegistry::getTableLocator()->get('StateUsers');
// hack for pauls public key format with many FF instead of the real values
$stateUsers = $stateUsersTable->find('all')->select(['id', 'public_key']);
$debug_user_publics = [];
foreach($stateUsers as $user) {
$user_public = stream_get_contents($user->public_key);
$debug_user_publics[] = bin2hex($user_public);
if(($user_public & $userPublicBin) == $user_public) {
array_push($this->state_users, (int)$user->id);
return $user->id;
}
}
return [
'state' => 'error',
'msg' => '[GradidoModifieUserBalance::getUserId] couldn\'t find user via public key binary &',
'details' => ['input public' => $userPublicKey, 'user publics' => $debug_user_publics]
];
// hack end
$stateUser = $stateUsersTable->find('all')->where(['public_key' => hex2bin($userPublicKey)]); $stateUser = $stateUsersTable->find('all')->where(['public_key' => hex2bin($userPublicKey)]);
if($stateUser->isEmpty()) { if($stateUser->isEmpty()) {
return ['state' => 'error', 'msg' => 'couldn\'t find user via public key']; return ['state' => 'error', 'msg' => '[GradidoModifieUserBalance::getUserId] couldn\'t find user via public key'];
} }
$id = $stateUser->first()->id; $id = $stateUser->first()->id;
if($id && is_int($id) && (int)$id > 0 && !in_array((int)$id, $this->state_users)) { if($id && is_int($id) && (int)$id > 0 && !in_array((int)$id, $this->state_users)) {
array_push($this->state_users, (int)$id); array_push($this->state_users, (int)$id);
} }
return $stateUser->first()->id; return $id;
} }
public function updateBalance($newBalance, $recordDate, $userId) public function updateBalance($newBalance, $recordDate, $userId)
@ -138,6 +158,9 @@ class ManageNodeGroupAdd extends GradidoModifieUserBalance
$transactionGroupAddadressTable = TableRegistry::getTableLocator()->get('TransactionGroupAddaddress'); $transactionGroupAddadressTable = TableRegistry::getTableLocator()->get('TransactionGroupAddaddress');
$stateGroupAddresses = TableRegistry::getTableLocator()->get('StateGroupAddresses'); $stateGroupAddresses = TableRegistry::getTableLocator()->get('StateGroupAddresses');
$transactionGroupEntity = $transactionGroupAddadressTable->newEntity(); $transactionGroupEntity = $transactionGroupAddadressTable->newEntity();
if(!is_int($transactionId)) {
return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] transaction id is not int', 'details' => $transactionId];
}
$transactionGroupEntity->transaction_id = $transactionId; $transactionGroupEntity->transaction_id = $transactionId;
$transactionGroupEntity->address_type_id = 1; $transactionGroupEntity->address_type_id = 1;
if(strlen($this->user_pubkey) != 64) { if(strlen($this->user_pubkey) != 64) {
@ -147,13 +170,19 @@ class ManageNodeGroupAdd extends GradidoModifieUserBalance
return ['state' => 'error', 'msg' => 'user_pubkey isn\'t in hex format']; return ['state' => 'error', 'msg' => 'user_pubkey isn\'t in hex format'];
} }
$transactionGroupEntity->public_key = hex2bin($this->user_pubkey); $userPubkeyBin = hex2bin($this->user_pubkey);
$transactionGroupEntity->state_user_id = $this->getUserId($this->user_pubkey);
$transactionGroupEntity->public_key = $userPubkeyBin;
$user_id = $this->getUserId($this->user_pubkey);
if(!is_int($user_id)) {
return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] user id is not int', 'details' => $user_id];
}
$transactionGroupEntity->state_user_id = $user_id;
$transactionGroupEntity->remove_from_group = $this->remove_from_group; $transactionGroupEntity->remove_from_group = $this->remove_from_group;
if(!$transactionGroupAddadressTable->save($transactionGroupEntity)) { if(!$transactionGroupAddadressTable->save($transactionGroupEntity)) {
return ['state' => 'error', 'msg' => 'error saving TransactionGroupAddaddress Entity', 'details' => $transactionGroupEntity->getErrors()]; return ['state' => 'error', 'msg' => 'error saving TransactionGroupAddaddress Entity', 'details' => $transactionGroupEntity->getErrors()];
} }
$userPubkeyBin = hex2bin($this->user_pubkey);
if($this->remove_from_group) { if($this->remove_from_group) {
$stateGroup_query = $stateGroupAddresses->find('all')->where(['public_key' => hex2bin($this->user_pubkey)]); $stateGroup_query = $stateGroupAddresses->find('all')->where(['public_key' => hex2bin($this->user_pubkey)]);
@ -351,6 +380,9 @@ class Record
public function parseRecord($json) { public function parseRecord($json) {
if(!isset($json['record_type'])) {
return false;
}
//var_dump($json); //var_dump($json);
switch($json['record_type']) { switch($json['record_type']) {
case 'GRADIDO_TRANSACTION': case 'GRADIDO_TRANSACTION':
@ -399,7 +431,9 @@ class Record
$newTransaction->id = $this->sequenceNumber; $newTransaction->id = $this->sequenceNumber;
$newTransaction->transaction_type_id = $transactionTypeResults->first()->id; $newTransaction->transaction_type_id = $transactionTypeResults->first()->id;
$newTransaction->memo = $this->memo; $newTransaction->memo = $this->memo;
if($this->runningHash != '' && strlen($this->runningHash) % 2 == 0) {
$newTransaction->tx_hash = hex2bin($this->runningHash); $newTransaction->tx_hash = hex2bin($this->runningHash);
}
$newTransaction->received = $this->received; $newTransaction->received = $this->received;
//! TODO change into transaction, if at least one fail, rollback //! TODO change into transaction, if at least one fail, rollback
@ -417,7 +451,7 @@ class Record
foreach($this->signatures as $sign) { foreach($this->signatures as $sign) {
$sign_result = $sign->finalize($this->sequenceNumber); $sign_result = $sign->finalize($this->sequenceNumber);
iF($sign_result !== true) { if($sign_result !== true) {
return ['state' => 'error', 'msg', 'error finalizing signature', 'details' => $sign_result]; return ['state' => 'error', 'msg', 'error finalizing signature', 'details' => $sign_result];
} }
} }

View File

@ -4,8 +4,8 @@
* @var \App\Model\Entity\StateGroupAddress $stateGroupAddress * @var \App\Model\Entity\StateGroupAddress $stateGroupAddress
*/ */
?> ?>
<nav id="actions-sidebar"> <nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="nav-horizontal nav-smaller"> <ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li> <li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('List State Group Addresses'), ['action' => 'index']) ?></li> <li><?= $this->Html->link(__('List State Group Addresses'), ['action' => 'index']) ?></li>
<li><?= $this->Html->link(__('List State Groups'), ['controller' => 'StateGroups', 'action' => 'index']) ?></li> <li><?= $this->Html->link(__('List State Groups'), ['controller' => 'StateGroups', 'action' => 'index']) ?></li>
@ -19,7 +19,7 @@
<fieldset> <fieldset>
<legend><?= __('Add State Group Address') ?></legend> <legend><?= __('Add State Group Address') ?></legend>
<?php <?php
echo $this->Form->control('state_group_id', ['options' => $stateGroups]); echo $this->Form->control('group_id');
echo $this->Form->control('address_type_id', ['options' => $addressTypes]); echo $this->Form->control('address_type_id', ['options' => $addressTypes]);
?> ?>
</fieldset> </fieldset>

View File

@ -4,8 +4,8 @@
* @var \App\Model\Entity\StateGroupAddress $stateGroupAddress * @var \App\Model\Entity\StateGroupAddress $stateGroupAddress
*/ */
?> ?>
<nav id="actions-sidebar"> <nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="nav-horizontal nav-smaller"> <ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li> <li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Form->postLink( <li><?= $this->Form->postLink(
__('Delete'), __('Delete'),
@ -25,7 +25,7 @@
<fieldset> <fieldset>
<legend><?= __('Edit State Group Address') ?></legend> <legend><?= __('Edit State Group Address') ?></legend>
<?php <?php
echo $this->Form->control('state_group_id', ['options' => $stateGroups]); echo $this->Form->control('group_id');
echo $this->Form->control('address_type_id', ['options' => $addressTypes]); echo $this->Form->control('address_type_id', ['options' => $addressTypes]);
?> ?>
</fieldset> </fieldset>

View File

@ -4,8 +4,8 @@
* @var \App\Model\Entity\StateGroupAddress[]|\Cake\Collection\CollectionInterface $stateGroupAddresses * @var \App\Model\Entity\StateGroupAddress[]|\Cake\Collection\CollectionInterface $stateGroupAddresses
*/ */
?> ?>
<nav id="actions-sidebar"> <nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="nav-horizontal nav-smaller"> <ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li> <li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('New State Group Address'), ['action' => 'add']) ?></li> <li><?= $this->Html->link(__('New State Group Address'), ['action' => 'add']) ?></li>
<li><?= $this->Html->link(__('List State Groups'), ['controller' => 'StateGroups', 'action' => 'index']) ?></li> <li><?= $this->Html->link(__('List State Groups'), ['controller' => 'StateGroups', 'action' => 'index']) ?></li>
@ -20,8 +20,9 @@
<thead> <thead>
<tr> <tr>
<th scope="col"><?= $this->Paginator->sort('id') ?></th> <th scope="col"><?= $this->Paginator->sort('id') ?></th>
<th scope="col"><?= $this->Paginator->sort('state_group_id') ?></th> <th scope="col"><?= $this->Paginator->sort('group_id') ?></th>
<th scope="col"><?= $this->Paginator->sort('address_type_id') ?></th> <th scope="col"><?= $this->Paginator->sort('address_type_id') ?></th>
<th scope="col"><?= __('user public key') ?></th>
<th scope="col" class="actions"><?= __('Actions') ?></th> <th scope="col" class="actions"><?= __('Actions') ?></th>
</tr> </tr>
</thead> </thead>
@ -29,8 +30,9 @@
<?php foreach ($stateGroupAddresses as $stateGroupAddress): ?> <?php foreach ($stateGroupAddresses as $stateGroupAddress): ?>
<tr> <tr>
<td><?= $this->Number->format($stateGroupAddress->id) ?></td> <td><?= $this->Number->format($stateGroupAddress->id) ?></td>
<td><?= $stateGroupAddress->has('state_group') ? $this->Html->link($stateGroupAddress->state_group->name, ['controller' => 'StateGroups', 'action' => 'view', $stateGroupAddress->state_group->id]) : '' ?></td> <td><?= $this->Number->format($stateGroupAddress->group_id) ?></td>
<td><?= $stateGroupAddress->has('address_type') ? $this->Html->link($stateGroupAddress->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $stateGroupAddress->address_type->id]) : '' ?></td> <td><?= $stateGroupAddress->has('address_type') ? $this->Html->link($stateGroupAddress->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $stateGroupAddress->address_type->id]) : '' ?></td>
<td><?= bin2hex(stream_get_contents($stateGroupAddress->public_key)) ?>
<td class="actions"> <td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $stateGroupAddress->id]) ?> <?= $this->Html->link(__('View'), ['action' => 'view', $stateGroupAddress->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $stateGroupAddress->id]) ?> <?= $this->Html->link(__('Edit'), ['action' => 'edit', $stateGroupAddress->id]) ?>
@ -40,8 +42,8 @@
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<div> <div class="paginator">
<ul class="nav-horizontal"> <ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?> <?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?> <?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?> <?= $this->Paginator->numbers() ?>

View File

@ -4,8 +4,8 @@
* @var \App\Model\Entity\StateGroupAddress $stateGroupAddress * @var \App\Model\Entity\StateGroupAddress $stateGroupAddress
*/ */
?> ?>
<nav id="actions-sidebar"> <nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="nav-horizontal nav-smaller"> <ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li> <li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('Edit State Group Address'), ['action' => 'edit', $stateGroupAddress->id]) ?> </li> <li><?= $this->Html->link(__('Edit State Group Address'), ['action' => 'edit', $stateGroupAddress->id]) ?> </li>
<li><?= $this->Form->postLink(__('Delete State Group Address'), ['action' => 'delete', $stateGroupAddress->id], ['confirm' => __('Are you sure you want to delete # {0}?', $stateGroupAddress->id)]) ?> </li> <li><?= $this->Form->postLink(__('Delete State Group Address'), ['action' => 'delete', $stateGroupAddress->id], ['confirm' => __('Are you sure you want to delete # {0}?', $stateGroupAddress->id)]) ?> </li>
@ -20,10 +20,6 @@
<div class="stateGroupAddresses view large-9 medium-8 columns content"> <div class="stateGroupAddresses view large-9 medium-8 columns content">
<h3><?= h($stateGroupAddress->id) ?></h3> <h3><?= h($stateGroupAddress->id) ?></h3>
<table class="vertical-table"> <table class="vertical-table">
<tr>
<th scope="row"><?= __('State Group') ?></th>
<td><?= $stateGroupAddress->has('state_group') ? $this->Html->link($stateGroupAddress->state_group->name, ['controller' => 'StateGroups', 'action' => 'view', $stateGroupAddress->state_group->id]) : '' ?></td>
</tr>
<tr> <tr>
<th scope="row"><?= __('Address Type') ?></th> <th scope="row"><?= __('Address Type') ?></th>
<td><?= $stateGroupAddress->has('address_type') ? $this->Html->link($stateGroupAddress->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $stateGroupAddress->address_type->id]) : '' ?></td> <td><?= $stateGroupAddress->has('address_type') ? $this->Html->link($stateGroupAddress->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $stateGroupAddress->address_type->id]) : '' ?></td>
@ -32,5 +28,9 @@
<th scope="row"><?= __('Id') ?></th> <th scope="row"><?= __('Id') ?></th>
<td><?= $this->Number->format($stateGroupAddress->id) ?></td> <td><?= $this->Number->format($stateGroupAddress->id) ?></td>
</tr> </tr>
<tr>
<th scope="row"><?= __('Group Id') ?></th>
<td><?= $this->Number->format($stateGroupAddress->group_id) ?></td>
</tr>
</table> </table>
</div> </div>

View File

@ -22,6 +22,7 @@
<th scope="col"><?= $this->Paginator->sort('id') ?></th> <th scope="col"><?= $this->Paginator->sort('id') ?></th>
<th scope="col"><?= $this->Paginator->sort('transaction_id') ?></th> <th scope="col"><?= $this->Paginator->sort('transaction_id') ?></th>
<th scope="col"><?= $this->Paginator->sort('address_type_id') ?></th> <th scope="col"><?= $this->Paginator->sort('address_type_id') ?></th>
<th scope="col"><?= __('user public key') ?></th>
<th scope="col" class="actions"><?= __('Actions') ?></th> <th scope="col" class="actions"><?= __('Actions') ?></th>
</tr> </tr>
</thead> </thead>
@ -31,6 +32,7 @@
<td><?= $this->Number->format($transactionGroupAddaddres->id) ?></td> <td><?= $this->Number->format($transactionGroupAddaddres->id) ?></td>
<td><?= $transactionGroupAddaddres->has('transaction') ? $this->Html->link($transactionGroupAddaddres->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $transactionGroupAddaddres->transaction->id]) : '' ?></td> <td><?= $transactionGroupAddaddres->has('transaction') ? $this->Html->link($transactionGroupAddaddres->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $transactionGroupAddaddres->transaction->id]) : '' ?></td>
<td><?= $transactionGroupAddaddres->has('address_type') ? $this->Html->link($transactionGroupAddaddres->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $transactionGroupAddaddres->address_type->id]) : '' ?></td> <td><?= $transactionGroupAddaddres->has('address_type') ? $this->Html->link($transactionGroupAddaddres->address_type->name, ['controller' => 'AddressTypes', 'action' => 'view', $transactionGroupAddaddres->address_type->id]) : '' ?></td>
<td><?= bin2hex(stream_get_contents($transactionGroupAddaddres->public_key)) ?>
<td class="actions"> <td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $transactionGroupAddaddres->id]) ?> <?= $this->Html->link(__('View'), ['action' => 'view', $transactionGroupAddaddres->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $transactionGroupAddaddres->id]) ?> <?= $this->Html->link(__('Edit'), ['action' => 'edit', $transactionGroupAddaddres->id]) ?>

@ -1 +1 @@
Subproject commit 81a461566e46d71533dc3e284fa075d7d68fd020 Subproject commit 9004e6978ac3dafcc635b2ffcf8bc6a156451cca

View File

@ -15,16 +15,17 @@ class StateGroupAddressesFixture extends TestFixture
*/ */
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
public $fields = [ public $fields = [
'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null],
'state_group_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'group_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
'public_key' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], 'public_key' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null],
'address_type_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'address_type_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null],
'_constraints' => [ '_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
'public_key' => ['type' => 'unique', 'columns' => ['public_key'], 'length' => []],
], ],
'_options' => [ '_options' => [
'engine' => 'InnoDB', 'engine' => 'InnoDB',
'collation' => 'utf8_bin' 'collation' => 'utf8mb4_unicode_ci'
], ],
]; ];
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
@ -38,9 +39,9 @@ class StateGroupAddressesFixture extends TestFixture
$this->records = [ $this->records = [
[ [
'id' => 1, 'id' => 1,
'state_group_id' => 1, 'group_id' => 1,
'public_key' => 'Lorem ipsum dolor sit amet', 'public_key' => 'Lorem ipsum dolor sit amet',
'address_type_id' => 1 'address_type_id' => 1,
], ],
]; ];
parent::init(); parent::init();