|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of Phuria SQL Builder package. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (c) 2016 Beniamin Jonatan Šimko |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Phuria\SQLBuilder\QueryBuilder; |
|
13
|
|
|
|
|
14
|
|
|
use Phuria\SQLBuilder\Parameter\ParameterManager; |
|
15
|
|
|
use Phuria\SQLBuilder\Parameter\ParameterManagerInterface; |
|
16
|
|
|
use Phuria\SQLBuilder\QueryCompiler\QueryCompiler; |
|
17
|
|
|
use Phuria\SQLBuilder\QueryCompiler\QueryCompilerInterface; |
|
18
|
|
|
use Phuria\SQLBuilder\ReferenceManager; |
|
19
|
|
|
use Phuria\SQLBuilder\TableFactory\TableFactory; |
|
20
|
|
|
use Phuria\SQLBuilder\TableFactory\TableFactoryInterface; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @author Beniamin Jonatan Šimko <[email protected]> |
|
24
|
|
|
*/ |
|
25
|
|
|
abstract class AbstractBuilder |
|
26
|
|
|
{ |
|
27
|
30 |
|
public function __construct() |
|
28
|
|
|
{ |
|
29
|
30 |
|
$this->tableFactory = new TableFactory(); |
|
|
|
|
|
|
30
|
30 |
|
$this->queryCompiler = new QueryCompiler(); |
|
|
|
|
|
|
31
|
30 |
|
$this->parameterManager = new ParameterManager(); |
|
|
|
|
|
|
32
|
30 |
|
$this->referenceManager = new ReferenceManager(); |
|
|
|
|
|
|
33
|
30 |
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @return AbstractBuilder |
|
37
|
|
|
*/ |
|
38
|
27 |
|
public function getQueryBuilder() |
|
39
|
|
|
{ |
|
40
|
27 |
|
return $this; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return TableFactoryInterface |
|
45
|
|
|
*/ |
|
46
|
26 |
|
public function getTableFactory() |
|
47
|
|
|
{ |
|
48
|
26 |
|
return $this->tableFactory; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return QueryCompilerInterface |
|
53
|
|
|
*/ |
|
54
|
27 |
|
public function getQueryCompiler() |
|
55
|
|
|
{ |
|
56
|
27 |
|
return $this->queryCompiler; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @return ParameterManagerInterface |
|
61
|
|
|
*/ |
|
62
|
13 |
|
public function getParameterManager() |
|
63
|
|
|
{ |
|
64
|
13 |
|
return $this->parameterManager; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @return ReferenceManager |
|
69
|
|
|
*/ |
|
70
|
27 |
|
public function getReferenceManager() |
|
71
|
|
|
{ |
|
72
|
27 |
|
return $this->referenceManager; |
|
73
|
|
|
} |
|
74
|
|
|
} |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: