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; namespace mirzaev\record\interfaces;
// Baza database // Baza database
use mirzaev\baza\record as baza_record; use mirzaev\baza\record as baza;
// Built-in libraries // Built-in libraries
use InvalidArgumentException as exception_invalid_argument; use InvalidArgumentException as exception_invalid_argument;
@@ -33,11 +33,9 @@ interface record
* *
* @throws exception_invalid_argument If not initialized the database columns parameters * @throws exception_invalid_argument If not initialized the database columns parameters
* *
* @param baza_record|null $record The record
*
* @return void * @return void
*/ */
public function __construct(?baza_record $record = null); public function __construct(?baza $record = null);
/** /**
* Read * 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 // Baza database
use mirzaev\baza\database, use mirzaev\baza\database,
mirzaev\baza\column, mirzaev\baza\column,
mirzaev\baza\record as baza_record, mirzaev\baza\record as baza,
mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type; mirzaev\baza\enumerations\type;
// Built-in libraries // Built-in libraries
@@ -44,18 +43,18 @@ trait record
/** /**
* Record * Record
* *
* @var baza_record $record The record instance * @var baza $record The record instance
*/ */
protected baza_record $record; protected baza $record;
/** /**
* Constructor * Constructor
* *
* @method baza_record|null $record The record * @method record|null $record The record
* *
* @return void * @return void
*/ */
public function __construct(?baza_record $record = null) public function __construct(?record $record = null)
{ {
// Initializing the database // Initializing the database
/* $this->database = new database() /* $this->database = new database()
@@ -68,7 +67,7 @@ trait record
->connect($this->file); */ ->connect($this->file); */
// Initializing the record // 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 offset: 0
)[0] ?? false; )[0] ?? false;
if ($record instanceof baza_record) { if ($record instanceof baza) {
// Initialized the record // Initialized the record
// Exit (success) // Exit (success)
@@ -109,8 +108,8 @@ trait record
{ {
// Writing into the database // Writing into the database
$record = $this->database->read( $record = $this->database->read(
filter: fn(baza_record $record) => $record->identifier === $this->record->identifier, filter: fn(baza $record) => $record->identifier === $this->record->identifier,
update: function (baza_record &$record) { update: function (baza &$record) {
$this->record->updated = svoboda::timestamp(); $this->record->updated = svoboda::timestamp();
$record = $this->record; $record = $this->record;
}, },
@@ -118,7 +117,7 @@ trait record
offset: 0 offset: 0
)[0] ?? false; )[0] ?? false;
if ($record instanceof baza_record) { if ($record instanceof record) {
// Initialized the record // Initialized the record
// Exit (success) // Exit (success)