Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91af1ea14f | ||
|
|
41523e6899 | ||
|
|
4a56e42af4 |
@@ -10,12 +10,12 @@ Stable version
|
|||||||
composer require rmphp/storage
|
composer require rmphp/storage
|
||||||
```
|
```
|
||||||
```bash
|
```bash
|
||||||
composer require rmphp/storage:"^9.0"
|
composer require rmphp/storage:"^10.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Dev version contains the latest changes
|
Dev version contains the latest changes
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer require rmphp/storage:"9.x-dev"
|
composer require rmphp/storage:"10.x-dev"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ abstract class AbstractEntity implements EntityInterface {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function __get(string $name) {
|
public function __get(string $name) {
|
||||||
return $this->$name ?? "";
|
return $this->$name ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,26 +13,23 @@ class MysqlStorage implements MysqlStorageInterface {
|
|||||||
private Mysqli $mysqli;
|
private Mysqli $mysqli;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Внутренний конструктор подключения к БД
|
* @param array $paramsArray
|
||||||
* Mysql constructor.
|
|
||||||
* @param object $params
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(array $paramsArray) {
|
||||||
private readonly object $params
|
$params = (object) $paramsArray;
|
||||||
) {
|
|
||||||
$this->mysqli = new mysqli(
|
$this->mysqli = new mysqli(
|
||||||
$this->params->host,
|
$params->host,
|
||||||
$this->params->user,
|
$params->user,
|
||||||
$this->params->pass,
|
$params->pass,
|
||||||
$this->params->base
|
$params->base
|
||||||
);
|
);
|
||||||
// выводим ошибку при неудачном подключении
|
// выводим ошибку при неудачном подключении
|
||||||
if ($this->mysqli->connect_errno) {
|
if ($this->mysqli->connect_errno) {
|
||||||
throw new Exception($this->mysqli->connect_errno);
|
throw new Exception($this->mysqli->connect_errno);
|
||||||
}
|
}
|
||||||
$this->mysqli->set_charset("utf8");
|
$this->mysqli->set_charset($params->chartset ?? "utf8");
|
||||||
if(!empty($this->params->logsEnable)) $this->logsEnabled = true;
|
if(!empty($params->logs)) $this->logsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|||||||
Reference in New Issue
Block a user