Repository: aimeos/aimeos-core (language: php)

Issue:
Bug in fromArray() method of Base class of domain item
# Bug Report (aimeos-core)

- **Laravel** : 8.12
- **Aimeos** : 2020.10
- **PHP Version** : 7.4.13
- **Environment** : Windows

## **Bug Definition**

> _fromArray()_ method of _[Aimeos\MShop\Common\Item\Base.php](https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Common/Item/Base.php)_ does not call _setModified()_ for custom column(s) of any domain table which as a result causes domain manager to **skip saving the domain item** in its _saveItem()_ method when only custom column is modified because _isModified()_ returns false in _saveItem()_ method of domain manager.

## **Bug Reproducibility**

1. Create a new **aimeos-laravel** project.
2. Create a **custom aimeos extension** in the project.
3. Add a **custom column** in any domain table (e.g. mshop_stock) by creating a schema definition file in custom extension and run `php artisan aimeos:setup` command.
4. Create a **decorator** for the domain manager of the **modified domain table** (e.g. 'stock' domain manager) and add that decorator in decorators list of manager configuration.
5. Now executing the code of following type will reproduce the bug

```php
$context = $this->getContext();
$manager = \Aimeos\MShop::create($context, '<your-domain>');
$data = [
    '<your-domain.key1>' => '<value1>',
    '<your-domain.key2>' => '<value2>',
        ...
    '<custom-column>' => '<value>',
        ...
];
$item = $manager->get('<item-id>');
$item = $item->fromArray($data);
// Now, calling saveItem() will not save modified item
// when the only difference between old item and
// modified item is value of <custom-column>.
$manager->saveItem($item);
```

## **Solution**

At line number 391 in [Aimeos\MShop\Common\Item\Base.php](https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Common/Item/Base.php)

Change this -

`$this->bdata[$key] = $value;`

to this -

`$this->set($key, $value);`


Discussion / hints:
Thanks a lot for your report!
Can you please create a PR to fix the issue?
> Thanks a lot for your report!
> Can you please create a PR to fix the issue?

Sure

Fix patch:
diff --git a/lib/mshoplib/src/MShop/Common/Item/Base.php b/lib/mshoplib/src/MShop/Common/Item/Base.php
index a8d543f06a..6dbb3ceaac 100644
--- a/lib/mshoplib/src/MShop/Common/Item/Base.php
+++ b/lib/mshoplib/src/MShop/Common/Item/Base.php
@@ -388,7 +388,7 @@ public function fromArray( array &$list, bool $private = false ) : \Aimeos\MShop
 		foreach( $list as $key => $value )
 		{
 			if( is_scalar( $value ) && strpos( $key, '.' ) === false ) {
-				$this->bdata[$key] = $value;
+				$this->set( $key, $value );
 			}
 		}
 


Test patch: