Configuration.php 2.11 KB
Newer Older
1
<?php 
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19

20 21
namespace Doctrine\DBAL;

Roman S. Borschel's avatar
Roman S. Borschel committed
22
use Doctrine\DBAL\Logging\SQLLogger;
23 24

/**
25
 * Configuration container for the Doctrine DBAL.
26
 *
27 28 29 30
 * @since   2.0
 * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
 * @author  Jonathan Wage <jonwage@gmail.com>
 * @author  Roman Borschel <roman@code-factory.org>
31 32
 * @internal When adding a new configuration option just write a getter/setter
 *           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 41
     *
     * @var array
     */
42
    protected $_attributes = array();
43

44 45 46
    /**
     * Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
     *
47
     * @param SQLLogger $logger
48
     */
Roman S. Borschel's avatar
Roman S. Borschel committed
49
    public function setSQLLogger(SQLLogger $logger)
50 51 52
    {
        $this->_attributes['sqlLogger'] = $logger;
    }
53

54 55 56
    /**
     * Gets the SQL logger that is used.
     * 
57
     * @return SQLLogger
58
     */
59
    public function getSQLLogger()
60
    {
61 62
        return isset($this->_attributes['sqlLogger']) ?
                $this->_attributes['sqlLogger'] : null;
63
    }
64
}