BasketController: show "diff" also for new objects

This commit is contained in:
Thomas Gelf 2018-10-08 18:17:12 +02:00
parent f0878a9bcd
commit a58efd2d25

View File

@ -283,9 +283,15 @@ class BasketController extends ActionController
} }
$objectFromBasket = $objects->$type->$key; $objectFromBasket = $objects->$type->$key;
$current = BasketSnapshot::instanceByIdentifier($type, $key, $connection); $current = BasketSnapshot::instanceByIdentifier($type, $key, $connection);
if ($current === null) {
$current = '';
} else {
$current = Json::encode($current->export(), JSON_PRETTY_PRINT);
}
$this->content()->add( $this->content()->add(
ConfigDiff::create( ConfigDiff::create(
Json::encode($current->export(), JSON_PRETTY_PRINT), $current,
Json::encode($objectFromBasket, JSON_PRETTY_PRINT) Json::encode($objectFromBasket, JSON_PRETTY_PRINT)
)->setHtmlRenderer('Inline') )->setHtmlRenderer('Inline')
); );