Completed
Pull Request — master (#3)
by Matt
02:41
created

nestedset_prefixes::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
rs 9.4285
cc 1
eloc 12
nc 1
nop 3
1
<?php
2
/**
3
 *
4
 * Topic Prefixes extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2016 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\topicprefixes\prefixes;
12
13
/**
14
 * Nested set class for Topic Prefixes
15
 */
16
class nestedset_prefixes extends \phpbb\tree\nestedset
17
{
18
	/**
19
	 * Construct
20
	 *
21
	 * @param \phpbb\db\driver\driver_interface $db         Database connection
22
	 * @param \phpbb\lock\db                    $lock       Lock class used to lock the table when moving forums around
23
	 * @param string                            $table_name Table name
24
	 */
25
	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\lock\db $lock, $table_name)
26
	{
27
		parent::__construct(
28
			$db,
29
			$lock,
30
			$table_name,
31
			'',
32
			'',
33
			[],
34
			[
35
				'item_id'		=> 'prefix_id',
36
				'parent_id'		=> 'prefix_parent_id',
37
				'left_id'		=> 'prefix_left_id',
38
				'right_id'		=> 'prefix_right_id',
39
				'item_parents'	=> 'prefix_parents',
40
			]
41
		);
42
	}
43
44
	/**
45
	 * Set additional sql where restrictions to use the forum id
46
	 *
47
	 * @param int $forum_id The forum identifier
48
	 * @return nestedset_prefixes $this object for chaining calls
49
	 */
50
	public function set_forum_id($forum_id)
51
	{
52
		$this->sql_where = '%sforum_id = ' . (int) $forum_id;
53
54
		return $this;
55
	}
56
}
57