Skip to content

Commit

Permalink
php 8.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Nov 26, 2024
1 parent 4453f48 commit 00aeb4a
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 102 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"license": "MIT",
"minimum-stability": "stable",
"require": {
"php": ">=7.4",
"vitexsoftware/ease-core": ">=1.45",
"fpdo/fluentpdo": ">=2.1"
},
Expand Down
10 changes: 8 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
php-vitexsoftware-ease-fluentpdo (1.3.0) UNRELEASED; urgency=medium
php-vitexsoftware-ease-fluentpdo (1.4.0) UNRELEASED; urgency=medium

* php 8.3 ready

-- vitex <info@vitexsoftware.cz> Tue, 26 Nov 2024 14:10:21 +0100

php-vitexsoftware-ease-fluentpdo (1.3.0) main; urgency=medium

* semantic versioning ready

-- vitex <info@vitexsoftware.cz> Sun, 17 Nov 2024 19:17:13 +0100
-- vitex <info@vitexsoftware.cz> Tue, 26 Nov 2024 14:10:07 +0100

php-vitexsoftware-ease-fluentpdo (1.2.1) main; urgency=medium

Expand Down
2 changes: 1 addition & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ file.reference.php-vitexsoftware-ease-fluentpdo-debian=debian
ignore.path=\
${file.reference.php-vitexsoftware-ease-fluentpdo-debian}
include.path=${php.global.include.path}
php.version=PHP_74
php.version=PHP_83
selenium.src.dir=tests
source.encoding=UTF-8
src.dir=.
Expand Down
20 changes: 19 additions & 1 deletion src/Ease/SQL/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ public function __construct($identifier = null, $options = [])
}
}

/**
* Properties to keep.
*
* @return array<string>
*/
public function __sleep(): array
{
return [
'myTable',
'keyColumn',
'nameColumn',
'createColumn',
'lastModifiedColumn',
'data',
];
}

/**
* Use Given value as identifier.
*
Expand Down Expand Up @@ -242,7 +259,8 @@ public function getAll()

/**
* Set/override object properties.
* @param array<string,string> $properties
*
* @param array<string, string> $properties
*/
public function setProperties(array $properties = []): void
{
Expand Down
48 changes: 23 additions & 25 deletions src/Ease/SQL/Orm.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ trait Orm
/**
* Database to connect by default.
*/
public ?string $database = null;
public string $database = '';

/**
* Database port.
Expand All @@ -50,30 +50,31 @@ trait Orm
*
* @var string mysql|pgsql|..
*/
public string $dbType;
public string $dbType = '';

/**
* Default connection settings.
*
* @var array<string,string>|string
* @var array<string, string>|string
*/
public $dbSettings = [];

/**
* Default connection setup.
* @var array<string,string> $connectionSetup
*
* @var array<string, string>
*/
public array $connectionSetup = [];

/**
* PDO Driver object.
*/
public ?PDO $pdo = null;
public ?\PDO $pdo = null;

/**
* Fluent Query.
*/
public \Envms\FluentPDO\Query $fluent = null;
public ?\Envms\FluentPDO\Query $fluent;

/**
* Poslední Chybová zpráva obdržená od SQL serveru.
Expand All @@ -83,7 +84,7 @@ trait Orm
/**
* Kod SQL chyby.
*/
protected int $errorNumber = 0;
protected int $errorNumber;

/**
* Only one rows returned ?
Expand All @@ -93,7 +94,7 @@ trait Orm
/**
* SetUp database connections.
*
* @param array<string,string> $options
* @param array<string, string> $options
*/
public function setUp(array $options = []): bool
{
Expand All @@ -105,8 +106,8 @@ public function setUp(array $options = []): bool
/**
* SetUp Object to be ready for connect.
*
* @param array<string,string> $options Object Options (dbType,server,username,password,database,
* port,connectionSettings,myTable,debug)
* @param array<string, string> $options Object Options (dbType,server,username,password,database,
* port,connectionSettings,myTable,debug)
*/
public function setUpDb($options = []): void
{
Expand All @@ -130,7 +131,7 @@ public function setUpDb($options = []): void
*
* @return \PDO SQL connector
*/
public function pdoConnect($options = []): PDO
public function pdoConnect($options = []): \PDO
{
$result = false;
$this->setUp($options);
Expand Down Expand Up @@ -231,7 +232,7 @@ public function getPdo($propeties = [])
*/
public function getFluentPDO(bool $read = false, bool $write = false)
{
if (!$this->fluent instanceof \Envms\FluentPDO\Query) {
if (!isset($this->fluent) || !($this->fluent instanceof \Envms\FluentPDO\Query)) {
$this->fluent = new \Envms\FluentPDO\Query($this->getPdo());
$this->fluent->exceptionOnError = true;
$this->fluent->debug = $this->debug ? function ($fluent): void {
Expand All @@ -248,23 +249,20 @@ public function getFluentPDO(bool $read = false, bool $write = false)

/**
* Basic Query to return all.
*
* @return \Envms\FluentPDO\Queries\Select
*/
public function listingQuery(): Select
public function listingQuery(): \Envms\FluentPDO\Queries\Select
{
return $this->getFluentPDO(true)->from($this->getMyTable());
}

/**
* Vrací z databáze sloupečky podle podmínek.
* Get database columns values by conditions.
*
* @param array $columnsList seznam položek
* @param array|int|string $conditions pole podmínek nebo ID záznamu
* @param array|string $orderBy třídit dle
* @param string $indexBy klice vysledku naplnit hodnotou ze
* sloupečku
* @param int $limit maximální počet vrácených záznamů
* @param array<string> $columnsList column names listing
* @param array|int|string $conditions conditions or ID
* @param array|string $orderBy sort by
* @param string $indexBy result keys by row keys
* @param int $limit maximum number of results
*
* @return array
*/
Expand Down Expand Up @@ -297,7 +295,7 @@ public function getColumnsFromSQL(
}

/**
* Load actual's $ItemID SQL data.
* Load actual $ItemID SQL data.
*
* @param int $itemID record key
*
Expand All @@ -309,9 +307,9 @@ public function getDataFromSQL($itemID = null, array $columnsList = ['*'])
}

/**
* Načte z SQL data k aktuálnímu $ItemID a použije je v objektu.
* Retrieves data from SQL for the current $ItemID and uses it in the object.
*
* @param array|int $itemID klíč záznamu
* @param array|int $itemID Record key
*
* @return array Results
*/
Expand Down
44 changes: 15 additions & 29 deletions src/Ease/SQL/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PDO extends SQL
/**
* SQLLink result.
*/
public \PDOStatement $result = null;
public \PDOStatement $result;

/**
* Connected state ?
Expand All @@ -53,52 +53,41 @@ class PDO extends SQL
public bool $debug = false;

/**
* KeyColumn used for postgresql insert id.
* KeyColumn used row key.
*/
public string $keyColumn = null;
public string $keyColumn = '';

/**
* Table used for postgresql insert id.
* Table name we used.
*/
public string $myTable = null;
public $data;
public string $myTable = '';
public $charset = 'utf8';
public $collate = 'utf8_czech_ci';

/**
* Povolit Explain každého dotazu do logu ?
* Allow Explain of each command to log logu ?
*
* @deprecated since version 1.4
*/
public bool $explainMode = false;

/**
* Database Type: mysql|sqlite|etc ...
* Database Type: mysql|sqlite|sqlsrv etc ...
*/
public string $dbType = null;
public string $dbType = '';

/**
* Saves obejct instace (singleton...).
* Saves object instance (singleton...).
*/
private static $_instance;

private string $errorText;

/**
* Virtuální funkce.
* cleanup.
*/
public function __destruct()
{
$this->pdo = null;
$this->result = null;
}

/**
* You cannot serialize or unserialize PDO instance.
*
* @return array fields to serialize
*/
public function __sleep()
{
return parent::__sleep();
}

public function __wakeup(): void
Expand Down Expand Up @@ -141,14 +130,11 @@ public function setKeyColumn($column = null)
}

/**
* Set Table used for PGSQL indertid.
* Set Table we work with.
*/
public function setTableName(string $tablename = ''): bool
public function setTableName(string $tablename): bool
{
if (!empty($tablename)) {
$this->myTable = $tablename;
}

$this->myTable = $tablename;
return true;
}

Expand Down
Loading

0 comments on commit 00aeb4a

Please sign in to comment.