Merge branch 'stable' of https://git.svoboda.works/mirzaev/record into stable
This commit is contained in:
@@ -4,21 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace mirzaev\record\interfaces;
|
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
|
// Built-in libraries
|
||||||
use Exception as exception,
|
use InvalidArgumentException as exception_invalid_argument;
|
||||||
RuntimeException as exception_runtime,
|
|
||||||
LogicException as exception_logic,
|
|
||||||
InvalidArgumentException as exception_invalid_argument;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Active Record
|
* Active Record
|
||||||
@@ -35,7 +22,7 @@ use Exception as exception,
|
|||||||
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
*/
|
*/
|
||||||
interface ar
|
interface record
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
@@ -10,7 +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,
|
mirzaev\baza\record as baza,
|
||||||
mirzaev\baza\enumerations\encoding,
|
mirzaev\baza\enumerations\encoding,
|
||||||
mirzaev\baza\enumerations\type;
|
mirzaev\baza\enumerations\type;
|
||||||
|
|
||||||
@@ -41,6 +41,13 @@ use Exception as exception,
|
|||||||
*/
|
*/
|
||||||
trait record
|
trait record
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Record
|
||||||
|
*
|
||||||
|
* @var baza $record The record instance
|
||||||
|
*/
|
||||||
|
protected baza $record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read
|
* Read
|
||||||
*
|
*
|
||||||
@@ -57,7 +64,7 @@ trait record
|
|||||||
offset: 0
|
offset: 0
|
||||||
)[0] ?? false;
|
)[0] ?? false;
|
||||||
|
|
||||||
if ($record instanceof record) {
|
if ($record instanceof baza) {
|
||||||
// Initialized the record
|
// Initialized the record
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
@@ -79,9 +86,9 @@ trait record
|
|||||||
{
|
{
|
||||||
// Writing into the database
|
// Writing into the database
|
||||||
$record = $this->database->read(
|
$record = $this->database->read(
|
||||||
filter: fn(record $record) => $record->identifier === $this->record->identifier,
|
filter: fn(baza $record) => $record->identifier === $this->record->identifier,
|
||||||
update: function (record &$record) {
|
update: function (baza &$record) {
|
||||||
$this->record->updated = mirzaev::timestamp();
|
$this->record->updated = svoboda::timestamp();
|
||||||
$record = $this->record;
|
$record = $this->record;
|
||||||
},
|
},
|
||||||
amount: 1,
|
amount: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user