|
1 <?php |
|
2 /* |
|
3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
14 * |
|
15 * This software consists of voluntary contributions made by many individuals |
|
16 * and is licensed under the LGPL. For more information, see |
|
17 * <http://www.doctrine-project.org>. |
|
18 */ |
|
19 |
|
20 namespace Doctrine\DBAL; |
|
21 |
|
22 use Doctrine\DBAL\Logging\SQLLogger; |
|
23 |
|
24 /** |
|
25 * Configuration container for the Doctrine DBAL. |
|
26 * |
|
27 * @since 2.0 |
|
28 * @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
|
29 * @author Jonathan Wage <jonwage@gmail.com> |
|
30 * @author Roman Borschel <roman@code-factory.org> |
|
31 * @internal When adding a new configuration option just write a getter/setter |
|
32 * pair and add the option to the _attributes array with a proper default value. |
|
33 */ |
|
34 class Configuration |
|
35 { |
|
36 /** |
|
37 * The attributes that are contained in the configuration. |
|
38 * Values are default values. |
|
39 * |
|
40 * @var array |
|
41 */ |
|
42 protected $_attributes = array(); |
|
43 |
|
44 /** |
|
45 * Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled. |
|
46 * |
|
47 * @param SQLLogger $logger |
|
48 */ |
|
49 public function setSQLLogger(SQLLogger $logger = null) |
|
50 { |
|
51 $this->_attributes['sqlLogger'] = $logger; |
|
52 } |
|
53 |
|
54 /** |
|
55 * Gets the SQL logger that is used. |
|
56 * |
|
57 * @return SQLLogger |
|
58 */ |
|
59 public function getSQLLogger() |
|
60 { |
|
61 return isset($this->_attributes['sqlLogger']) ? |
|
62 $this->_attributes['sqlLogger'] : null; |
|
63 } |
|
64 } |