Completed
Push — master ( a66447...95710b )
by Aimeos
02:15
created

Ezpublish::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2018
6
 * @package MShop
7
 * @subpackage Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Manager\Property;
12
13
14
/**
15
 * Default property manager implementation.
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class Ezpublish
21
	extends \Aimeos\MShop\Customer\Manager\Property\Standard
22
{
23
	private $searchConfig = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
24
		'customer.property.id' => array(
25
			'code' => 'customer.property.id',
26
			'internalcode' => 'ezppr."id"',
27
			'internaldeps'=>array( 'LEFT JOIN "ezp_user_property" AS ezppr ON ( ezppr."parentid" = ezp."id" )' ),
28
			'label' => 'Property ID',
29
			'type' => 'integer',
30
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
31
			'public' => false,
32
		),
33
		'customer.property.parentid' => array(
34
			'code' => 'customer.property.parentid',
35
			'internalcode' => 'ezppr."parentid"',
36
			'label' => 'Property parent ID',
37
			'type' => 'integer',
38
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
39
			'public' => false,
40
		),
41
		'customer.property.siteid' => array(
42
			'code' => 'customer.property.siteid',
43
			'internalcode' => 'ezppr."siteid"',
44
			'label' => 'Property site ID',
45
			'type' => 'integer',
46
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
47
			'public' => false,
48
		),
49
		'customer.property.typeid' => array(
50
			'code' => 'customer.property.typeid',
51
			'internalcode' => 'ezppr."typeid"',
52
			'label' => 'Property type ID',
53
			'type' => 'integer',
54
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
55
			'public' => false,
56
		),
57
		'customer.property.value' => array(
58
			'code' => 'customer.property.value',
59
			'internalcode' => 'ezppr."value"',
60
			'label' => 'Property value',
61
			'type' => 'string',
62
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
63
		),
64
		'customer.property.languageid' => array(
65
			'code' => 'customer.property.languageid',
66
			'internalcode' => 'ezppr."langid"',
67
			'label' => 'Property language ID',
68
			'type' => 'string',
69
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
70
		),
71
		'customer.property.ctime' => array(
72
			'code' => 'customer.property.ctime',
73
			'internalcode' => 'ezppr."ctime"',
74
			'label' => 'Property create date/time',
75
			'type' => 'datetime',
76
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
77
			'public' => false,
78
		),
79
		'customer.property.mtime' => array(
80
			'code' => 'customer.property.mtime',
81
			'internalcode' => 'ezppr."mtime"',
82
			'label' => 'Property modify date',
83
			'type' => 'datetime',
84
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
85
			'public' => false,
86
		),
87
		'customer.property.editor' => array(
88
			'code' => 'customer.property.editor',
89
			'internalcode' => 'ezppr."editor"',
90
			'label' => 'Property editor',
91
			'type' => 'string',
92
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
93
			'public' => false,
94
		),
95
	);
96
97
98
	/**
99
	 * Removes old entries from the storage.
100
	 *
101
	 * @param integer[] $siteids List of IDs for sites whose entries should be deleted
102
	 */
103
	public function cleanup( array $siteids )
104
	{
105
		$path = 'mshop/customer/manager/property/submanagers';
106
		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
107
			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
108
		}
109
110
		$this->cleanupBase( $siteids, 'mshop/customer/manager/property/ezpublish/delete' );
111
	}
112
113
114
	/**
115
	 * Returns the attributes that can be used for searching.
116
	 *
117
	 * @param boolean $withsub Return also attributes of sub-managers if true
118
	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
119
	 */
120
	public function getSearchAttributes( $withsub = true )
121
	{
122
		$path = 'mshop/customer/manager/property/submanagers';
123
124
		return $this->getSearchAttributesBase( $this->searchConfig, $path, ['type'], $withsub );
125
	}
126
127
128
	/**
129
	 * Returns a new manager for customer extensions
130
	 *
131
	 * @param string $manager Name of the sub manager type in lower case
132
	 * @param string|null $name Name of the implementation, will be from
133
	 * configuration (or Default) if null
134
	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g property types, property lists etc.
135
	 */
136
	public function getSubManager( $manager, $name = null )
137
	{
138
		return $this->getSubManagerBase( 'customer', 'property/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
139
	}
140
141
142
	/**
143
	 * Returns the config path for retrieving the configuration values.
144
	 *
145
	 * @return string Configuration path
146
	 */
147
	protected function getConfigPath()
148
	{
149
		return 'mshop/customer/manager/property/ezpublish/';
150
	}
151
152
153
	/**
154
	 * Returns the search configuration for searching items.
155
	 *
156
	 * @return array Associative list of search keys and search definitions
157
	 */
158
	protected function getSearchConfig()
159
	{
160
		return $this->searchConfig;
161
	}
162
}
163