public function toEntity($data)
{
$entity = parent::toEntity($data);
$converterRules = $this->getRules();
if (!is_object($data)) {
$data = (object) $data;
}
if (!empty($converterRules[static::RULE_TYPE_SETTINGS])) {
$collection = $this->getSettingsCollection($entity);
foreach ($this->getSettingsRules() as $key => $property) {
if (isset($data->{$property})) {
$collection[is_int($key) ? $property : $key] = $data->{$property};
}
}
}
return $entity;
}