php8 vc moved static created method to Model instead Item (for lines)
This commit is contained in:
parent
59b0b71303
commit
a728d384d7
|
@ -59,6 +59,26 @@ abstract class Model
|
|||
abstract static protected function encode(array $data): array;
|
||||
|
||||
|
||||
/**
|
||||
* Inserts a new item model in the database
|
||||
*
|
||||
* @param array $data Unknown input data structure.
|
||||
*
|
||||
* @return boolean The modeled element data structure stored into the DB.
|
||||
*
|
||||
* @overrides Model::save.
|
||||
*/
|
||||
public static function create(array $data=[]): int
|
||||
{
|
||||
// Insert.
|
||||
$save = static::encode($data);
|
||||
|
||||
$result = \db_process_sql_insert('tlayout_data', $save);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert or update an item in the database
|
||||
*
|
||||
|
|
|
@ -1801,26 +1801,6 @@ class Item extends CachedModel
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserts a new item in the database
|
||||
*
|
||||
* @param array $data Unknown input data structure.
|
||||
*
|
||||
* @return boolean The modeled element data structure stored into the DB.
|
||||
*
|
||||
* @overrides Model::save.
|
||||
*/
|
||||
public static function create(array $data=[]): int
|
||||
{
|
||||
// Insert.
|
||||
$save = static::encode($data);
|
||||
|
||||
$result = \db_process_sql_insert('tlayout_data', $save);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update an item in the database
|
||||
*
|
||||
|
|
|
@ -230,7 +230,7 @@ final class Line extends Model
|
|||
*
|
||||
* @overrides Model::encode.
|
||||
*/
|
||||
protected function encode(array $data): array
|
||||
protected static function encode(array $data): array
|
||||
{
|
||||
$result = [];
|
||||
$result['type'] = LINE_ITEM;
|
||||
|
@ -409,8 +409,8 @@ final class Line extends Model
|
|||
}
|
||||
} else {
|
||||
// Update.
|
||||
$dataModelEncode = $this->encode($this->toArray());
|
||||
$dataEncode = $this->encode($data);
|
||||
$dataModelEncode = static::encode($this->toArray());
|
||||
$dataEncode = static::encode($data);
|
||||
|
||||
$save = array_merge($dataModelEncode, $dataEncode);
|
||||
|
||||
|
|
Loading…
Reference in New Issue