Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Apr 12, 2021
1 parent 0f298c1 commit d2f21e2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file, in reverse
## [1.0.36] -

### Added
- getCustomTable and fetchCustomTable

## [1.0.35] - 2021-04-01

Expand Down
2 changes: 1 addition & 1 deletion module/Application/data/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ ALTER TABLE `core_perfomance_log`
--
CREATE TABLE `settings` (
`settings_key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`settings_value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
`settings_value` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

ALTER TABLE `settings`
Expand Down
62 changes: 62 additions & 0 deletions module/Application/src/Controller/CoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,68 @@ public function getFormTabs() {
return $aTabsByForms;
}

/**
* Get Custom TableGateway
*
* @param $sTableName
* @return TableGateway
* @since 1.0.36
*/
protected function getCustomTable($sTableName)
{
return new TableGateway($sTableName, CoreController::$oDbAdapter);
}

/**
* Fetch Custom Table via Gateway
*
* @param string $sTableName
* @param array|object $oWhere
* @return mixed
* @since 1.0.36
*/
protected function fetchCustomTable($sTableName,$oWhere = []) {
$oTbl = $this->getCustomTable($sTableName);

return $oTbl->select($oWhere);
}

/**
* Insert Data to Custom Table
*
* @param $sTableName
* @param $aData
* @return false
* @since 1.0.36
*/
protected function insertToCustomTable($sTableName,$aData) {
$oTbl = $this->getCustomTable($sTableName);

if($oTbl->insert($aData)) {
return $oTbl->lastInsertValue;
} else {
return false;
}
}

/**
* Update Data in custom table
*
* @param $sTableName
* @param $aData
* @param $aWhere
* @return bool
* @since 1.0.36
*/
protected function updateCustomTable($sTableName,$aData,$aWhere) {
$oTbl = $this->getCustomTable($sTableName);
if($oTbl->update($aData,$aWhere)) {
return true;
} else {
return false;
}
}

/**
* Load all permissions based on Modules
*
Expand Down

0 comments on commit d2f21e2

Please sign in to comment.