Completed
Push — master ( c1f25f...b3d94f )
by Aimeos
02:05
created

src/MShop/Customer/Manager/Lists/Laravel.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2018
6
 * @package MShop
7
 * @subpackage Customer
8
 */
9
10
11
namespace Aimeos\MShop\Customer\Manager\Lists;
12
13
14
/**
15
 * Laravel implementation of the customer list class.
16
 *
17
 * @package MShop
18
 * @subpackage Customer
19
 */
20
class Laravel
21
	extends \Aimeos\MShop\Customer\Manager\Lists\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.lists.id'=> array(
25
			'code'=>'customer.lists.id',
26
			'internalcode'=>'lvuli."id"',
27
			'internaldeps' => array( 'LEFT JOIN "users_list" AS lvuli ON ( lvu."id" = lvuli."parentid" )' ),
28
			'label'=>'Customer list ID',
29
			'type'=> 'integer',
30
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT,
31
			'public' => false,
32
		),
33
		'customer.lists.siteid'=> array(
34
			'code'=>'customer.lists.siteid',
35
			'internalcode'=>'lvuli."siteid"',
36
			'label'=>'Customer list site ID',
37
			'type'=> 'integer',
38
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT,
39
			'public' => false,
40
		),
41
		'customer.lists.parentid'=> array(
42
			'code'=>'customer.lists.parentid',
43
			'internalcode'=>'lvuli."parentid"',
44
			'label'=>'Customer list parent ID',
45
			'type'=> 'integer',
46
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT,
47
			'public' => false,
48
		),
49
		'customer.lists.domain'=> array(
50
			'code'=>'customer.lists.domain',
51
			'internalcode'=>'lvuli."domain"',
52
			'label'=>'Customer list domain',
53
			'type'=> 'string',
54
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
55
		),
56
		'customer.lists.type' => array(
57
			'code'=>'customer.lists.type',
58
			'internalcode'=>'lvuli."type"',
59
			'label'=>'Customer list type',
60
			'type'=> 'string',
61
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
62
		),
63
		'customer.lists.refid'=> array(
64
			'code'=>'customer.lists.refid',
65
			'internalcode'=>'lvuli."refid"',
66
			'label'=>'Customer list reference ID',
67
			'type'=> 'string',
68
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
69
		),
70
		'customer.lists.datestart' => array(
71
			'code'=>'customer.lists.datestart',
72
			'internalcode'=>'lvuli."start"',
73
			'label'=>'Customer list start date/time',
74
			'type'=> 'datetime',
75
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
76
		),
77
		'customer.lists.dateend' => array(
78
			'code'=>'customer.lists.dateend',
79
			'internalcode'=>'lvuli."end"',
80
			'label'=>'Customer list end date/time',
81
			'type'=> 'datetime',
82
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
83
		),
84
		'customer.lists.config' => array(
85
			'code'=>'customer.lists.config',
86
			'internalcode'=>'lvuli."config"',
87
			'label'=>'Customer list position',
88
			'type'=> 'string',
89
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
90
		),
91
		'customer.lists.position' => array(
92
			'code'=>'customer.lists.position',
93
			'internalcode'=>'lvuli."pos"',
94
			'label'=>'Customer list position',
95
			'type'=> 'integer',
96
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
97
		),
98
		'customer.lists.status' => array(
99
			'code'=>'customer.lists.status',
100
			'internalcode'=>'lvuli."status"',
101
			'label'=>'Customer list status',
102
			'type'=> 'integer',
103
			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
104
		),
105
		'customer.lists.ctime'=> array(
106
			'code'=>'customer.lists.ctime',
107
			'internalcode'=>'lvuli."ctime"',
108
			'label'=>'Customer list create date/time',
109
			'type'=> 'datetime',
110
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
111
		),
112
		'customer.lists.mtime'=> array(
113
			'code'=>'customer.lists.mtime',
114
			'internalcode'=>'lvuli."mtime"',
115
			'label'=>'Customer list modification date/time',
116
			'type'=> 'datetime',
117
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
118
		),
119
		'customer.lists.editor'=> array(
120
			'code'=>'customer.lists.editor',
121
			'internalcode'=>'lvuli."editor"',
122
			'label'=>'Customer list editor',
123
			'type'=> 'string',
124
			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR,
125
		),
126
	);
127
128
129
	/**
130
	 * Removes old entries from the storage.
131
	 *
132
	 * @param array $siteids List of IDs for sites whose entries should be deleted
133
	 */
134 View Code Duplication
	public function cleanup( array $siteids )
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
135
	{
136
		$path = 'mshop/customer/manager/lists/submanagers';
137
		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
138
			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
139
		}
140
141
		$this->cleanupBase( $siteids, 'mshop/customer/manager/lists/laravel/delete' );
142
	}
143
144
145
	/**
146
	 * Returns the list attributes that can be used for searching.
147
	 *
148
	 * @param boolean $withsub Return also attributes of sub-managers if true
149
	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
150
	 */
151
	public function getSearchAttributes( $withsub = true )
152
	{
153
		$path = 'mshop/customer/manager/lists/submanagers';
154
155
		return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub );
156
	}
157
158
159
	/**
160
	 * Returns a new manager for customer extensions
161
	 *
162
	 * @param string $manager Name of the sub manager type in lower case
163
	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
164
	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
165
	 */
166
	public function getSubManager( $manager, $name = null )
167
	{
168
		return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Laravel' : $name ) );
169
	}
170
171
172
	/**
173
	 * Returns the config path for retrieving the configuration values.
174
	 *
175
	 * @return string Configuration path (mshop/customer/manager/lists/laravel/)
176
	 */
177
	protected function getConfigPath()
178
	{
179
		return 'mshop/customer/manager/lists/laravel/';
180
	}
181
182
183
	/**
184
	 * Returns the search configuration for searching items.
185
	 *
186
	 * @return array Associative list of search keys and search definitions
187
	 */
188
	protected function getSearchConfig()
189
	{
190
		return $this->searchConfig;
191
	}
192
}
193