Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/MetaModels/DcGeneral/Data/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @author David Molineus <david.molineus@netzmacht.de>
* @author binron <rtb@gmx.ch>
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
* @copyright 2012-2018 The MetaModels team.
* @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
Expand Down Expand Up @@ -304,7 +305,7 @@ public function getEmptyConfig()
*/
public function getEmptyModel()
{
$objItem = new Item($this->getMetaModel(), array());
$objItem = new Item($this->getMetaModel(), null);
return new Model($objItem);
}

Expand Down
11 changes: 10 additions & 1 deletion src/MetaModels/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,19 @@ class Item implements IItem
*
* @param IMetaModel $objMetaModel The model this item is represented by.
*
* @param array $arrData The initial data that shall be injected into the new instance.
* @param array|null $arrData The initial data that shall be injected into the new instance.
*/
public function __construct(IMetaModel $objMetaModel, $arrData)
{
if (null === $arrData) {
// Initialize attributes with empty values.
$arrData = [];

foreach ($objMetaModel->getAttributes() as $attribute) {
$arrData[$attribute->getColName()] = null;
}
}

$this->arrData = $arrData;
$this->metaModel = $objMetaModel;
}
Expand Down