small fixes

This commit is contained in:
2025-11-03 16:59:44 +03:00
parent c2d6667120
commit b1ee745aac
2 changed files with 14 additions and 20 deletions

View File

@@ -4,21 +4,8 @@ declare(strict_types=1);
namespace mirzaev\record\interfaces;
// Svoboda time
use svoboda\time\statement as svoboda;
// Baza database
use mirzaev\baza\database,
mirzaev\baza\column,
mirzaev\baza\record,
mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type;
// Built-in libraries
use Exception as exception,
RuntimeException as exception_runtime,
LogicException as exception_logic,
InvalidArgumentException as exception_invalid_argument;
use InvalidArgumentException as exception_invalid_argument;
/**
* Active Record
@@ -35,7 +22,7 @@ use Exception as exception,
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
interface ar
interface record
{
/**
* Constructor

View File

@@ -10,7 +10,7 @@ use svoboda\time\statement as svoboda;
// Baza database
use mirzaev\baza\database,
mirzaev\baza\column,
mirzaev\baza\record,
mirzaev\baza\record as baza,
mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type;
@@ -41,6 +41,13 @@ use Exception as exception,
*/
trait record
{
/**
* Record
*
* @var baza $record The record instance
*/
protected baza $record;
/**
* Read
*
@@ -57,7 +64,7 @@ trait record
offset: 0
)[0] ?? false;
if ($record instanceof record) {
if ($record instanceof baza) {
// Initialized the record
// Exit (success)
@@ -79,9 +86,9 @@ trait record
{
// Writing into the database
$record = $this->database->read(
filter: fn(record $record) => $record->identifier === $this->record->identifier,
update: function (record &$record) {
$this->record->updated = mirzaev::timestamp();
filter: fn(baza $record) => $record->identifier === $this->record->identifier,
update: function (baza &$record) {
$this->record->updated = svoboda::timestamp();
$record = $this->record;
},
amount: 1,