Configuration.php 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. namespace Doctrine\DBAL;
  20. use Doctrine\DBAL\Logging\SQLLogger;
  21. /**
  22. * Configuration container for the Doctrine DBAL.
  23. *
  24. * @since 2.0
  25. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  26. * @author Jonathan Wage <jonwage@gmail.com>
  27. * @author Roman Borschel <roman@code-factory.org>
  28. * @internal When adding a new configuration option just write a getter/setter
  29. * pair and add the option to the _attributes array with a proper default value.
  30. */
  31. class Configuration
  32. {
  33. /**
  34. * The attributes that are contained in the configuration.
  35. * Values are default values.
  36. *
  37. * @var array
  38. */
  39. protected $_attributes = array();
  40. /**
  41. * Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
  42. *
  43. * @param SQLLogger $logger
  44. */
  45. public function setSQLLogger(SQLLogger $logger = null)
  46. {
  47. $this->_attributes['sqlLogger'] = $logger;
  48. }
  49. /**
  50. * Gets the SQL logger that is used.
  51. *
  52. * @return SQLLogger
  53. */
  54. public function getSQLLogger()
  55. {
  56. return isset($this->_attributes['sqlLogger']) ?
  57. $this->_attributes['sqlLogger'] : null;
  58. }
  59. }