Passed
Push — master ( 5788d1...3b28d2 )
by Aimeos
04:17
created

Changelog::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2011
6
 * @copyright Aimeos (aimeos.org), 2015-2022
7
 * @package MShop
8
 * @subpackage Common
9
 */
10
11
12
namespace Aimeos\MShop\Common\Manager\Decorator;
13
14
15
/**
16
 * Provides a changelog decorator for managers.
17
 *
18
 * @package MShop
19
 * @subpackage Common
20
 */
21
class Changelog
22
	extends \Aimeos\MShop\Common\Manager\Decorator\Base
23
{
24
	/**
25
	 * Deletes one or more items.
26
	 *
27
	 * @param \Aimeos\MShop\Common\Item\Iface|\Aimeos\Map|array|string $items Item object, ID or a list of them
28
	 * @return \Aimeos\MShop\Common\Manager\Iface Manager object for chaining method calls
29
	 */
30
	public function delete( $items ) : \Aimeos\MShop\Common\Manager\Iface
31
	{
32
		$this->getManager()->delete( $items );
33
34
		$this->context()->logger()->notice( $items, 'changelog:delete' );
35
36
		return $this;
37
	}
38
39
40
	/**
41
	 * Adds or updates an item object.
42
	 *
43
	 * @param \Aimeos\MShop\Common\Item\Iface $items Item object whose data should be saved
44
	 * @param bool $fetch True if the new ID should be returned in the item
45
	 * @return \Aimeos\Map|\Aimeos\MShop\Common\Item\Iface Updated item including the generated ID
46
	 */
47
	public function save( $items, bool $fetch = true )
48
	{
49
		$items = $this->getManager()->save( $items, true );
50
51
		$this->context()->logger()->notice( $items, 'changelog:save' );
52
53
		return $items;
54
	}
55
}
56