1 Commits
2.1.2 ... 2.0.0

Author SHA1 Message Date
1ad13ddd3f __construct(?record $record) 2025-11-16 12:59:13 +03:00
6 changed files with 12 additions and 15 deletions

0
.gitignore vendored Executable file → Normal file
View File

0
LICENSE Executable file → Normal file
View File

0
README.md Executable file → Normal file
View File

0
composer.json Executable file → Normal file
View File

6
mirzaev/record/system/interfaces/record.php Executable file → Normal file
View File

@@ -5,7 +5,7 @@ declare(strict_types=1);
namespace mirzaev\record\interfaces;
// Baza database
use mirzaev\baza\record as baza_record;
use mirzaev\baza\record as baza;
// Built-in libraries
use InvalidArgumentException as exception_invalid_argument;
@@ -33,11 +33,9 @@ interface record
*
* @throws exception_invalid_argument If not initialized the database columns parameters
*
* @param baza_record|null $record The record
*
* @return void
*/
public function __construct(?baza_record $record = null);
public function __construct(?baza $record = null);
/**
* Read

21
mirzaev/record/system/traits/record.php Executable file → Normal file
View File

@@ -10,8 +10,7 @@ use svoboda\time\statement as svoboda;
// Baza database
use mirzaev\baza\database,
mirzaev\baza\column,
mirzaev\baza\record as baza_record,
mirzaev\baza\enumerations\encoding,
mirzaev\baza\record as baza,
mirzaev\baza\enumerations\type;
// Built-in libraries
@@ -44,18 +43,18 @@ trait record
/**
* Record
*
* @var baza_record $record The record instance
* @var baza $record The record instance
*/
protected baza_record $record;
protected baza $record;
/**
* Constructor
*
* @method baza_record|null $record The record
* @method record|null $record The record
*
* @return void
*/
public function __construct(?baza_record $record = null)
public function __construct(?record $record = null)
{
// Initializing the database
/* $this->database = new database()
@@ -68,7 +67,7 @@ trait record
->connect($this->file); */
// Initializing the record
$record instanceof baza_record and $this->record = $record;
$record instanceof record and $this->record = $record;
}
/**
@@ -87,7 +86,7 @@ trait record
offset: 0
)[0] ?? false;
if ($record instanceof baza_record) {
if ($record instanceof baza) {
// Initialized the record
// Exit (success)
@@ -109,8 +108,8 @@ trait record
{
// Writing into the database
$record = $this->database->read(
filter: fn(baza_record $record) => $record->identifier === $this->record->identifier,
update: function (baza_record &$record) {
filter: fn(baza $record) => $record->identifier === $this->record->identifier,
update: function (baza &$record) {
$this->record->updated = svoboda::timestamp();
$record = $this->record;
},
@@ -118,7 +117,7 @@ trait record
offset: 0
)[0] ?? false;
if ($record instanceof baza_record) {
if ($record instanceof record) {
// Initialized the record
// Exit (success)