fixed by garden/campanula

This commit is contained in:
2026-01-07 14:57:15 +05:00
parent 190ef8eabd
commit a0ca54bf25
7 changed files with 102 additions and 89 deletions

View File

@@ -5,10 +5,7 @@ declare(strict_types=1);
namespace ${REPO_OWNER}\${REPO_NAME}\models;
// Files of the project
use ${REPO_OWNER}\${REPO_NAME}\models\core,
${REPO_OWNER}\${REPO_NAME}\models\tariff,
${REPO_OWNER}\${REPO_NAME}\models\enumerations\tariff as tariff_type,
${REPO_OWNER}\${REPO_NAME}\models\enumerations\acquiring as acquiring;
use ${REPO_OWNER}\${REPO_NAME}\models\core;
// Baza database
use mirzaev\baza\database,
@@ -70,6 +67,7 @@ final class settings extends core implements record_interface
new column('identifier', type::long_long_unsigned),
new column('account', type::long_long_unsigned),
/* new column('', type::), */
new column('active', type::char),
new column('updated', type::integer_unsigned),
new column('created', type::integer_unsigned)
)
@@ -82,16 +80,19 @@ final class settings extends core implements record_interface
/**
* Write
*
* @param int $$account The account identifier (0 for disable)
* @param int $$account The account identifier
* @param int $$active Is the record active?
*
* @return int|false The record identifier, if created
*/
public function write(
int $$account = 0,
int $$account,
bool $$active = true,
): int|false {
$$record = $$this->database->record(
$$this->database->count() + 1,
$$account,
(int) $$active,
svoboda::timestamp(),
svoboda::timestamp()
);
@@ -102,5 +103,33 @@ final class settings extends core implements record_interface
// Exit (success)
return $$created ? $$record->identifier : false;
}
/**
* Serialize
*
* @return self The instance from which the method was called (fluent interface)
*/
public function serialize(): self
{
// Serializing the record parameters
$$this->record->active = (int) $$this->record->active;
// Exit (success)
return $$this;
}
/**
* Deserialize
*
* @return self The instance from which the method was called (fluent interface)
*/
public function deserialize(): self
{
// Deserializing the record parameters
$$this->record->active = (bool) $$this->record->active;
// Exit (success)
return $$this;
}
}