blob: 2e47bd6bf53ff452de88bf5c52241c6621a4f229 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php
namespace Digitigrade\Model;
abstract class PushableModel extends FetchableModel implements \JsonSerializable {
public static function importFromReceivedObject(\stdClass $data, bool $autoSave = true): static {
$obj = static::createFromJson($data);
if ($autoSave) {
$obj->save();
$obj->finaliseAfterSave();
}
return $obj;
}
}
|