for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace FacturaScripts\Core\Model;
class SettingsModel extends Base\ModelClass
{
use Base\ModelTrait;
FacturaScripts\Core\Model\Base\ModelTrait
$name
FacturaScripts\Core\Model\SettingsModel
/** @var int */
public $id;
/** @var string */
public $classnamemodel;
public $idmodel;
public $idempresa;
/** @var array */
public $settings;
public static function primaryColumn(): string
return 'id';
}
public static function tableName(): string
return 'settings_model';
public function loadFromData(array $data = [], array $exclude = []): void
parent::loadFromData($data, ['settings', 'action']);
$this->settings = isset($data['settings']) ? json_decode($data['settings'], true) : [];
protected function saveUpdate(array $values = []): bool
// agregamos a la propiedad settings las propiedades que hay en el modelo
// y que nos vienen de la request/inputs
foreach ($this->settings as $key => $value) {
$this->settings[$key] = empty($this->{$key}) ? null : $this->{$key};
if (is_array($this->settings)) {
is_array($this->settings)
true
$this->settings = json_encode($this->settings);
json_encode($this->settings)
string
array
$settings
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
return parent::saveUpdate($values);