SchemaConfig.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\DBAL\Schema;
  20. /**
  21. * Configuration for a Schema.
  22. *
  23. * @link www.doctrine-project.org
  24. * @since 2.0
  25. * @author Benjamin Eberlei <kontakt@beberlei.de>
  26. */
  27. class SchemaConfig
  28. {
  29. /**
  30. * @var boolean
  31. */
  32. protected $hasExplicitForeignKeyIndexes = false;
  33. /**
  34. * @var integer
  35. */
  36. protected $maxIdentifierLength = 63;
  37. /**
  38. * @var string
  39. */
  40. protected $name;
  41. /**
  42. * @var array
  43. */
  44. protected $defaultTableOptions = array();
  45. /**
  46. * @return boolean
  47. */
  48. public function hasExplicitForeignKeyIndexes()
  49. {
  50. return $this->hasExplicitForeignKeyIndexes;
  51. }
  52. /**
  53. * @param boolean $flag
  54. *
  55. * @return void
  56. */
  57. public function setExplicitForeignKeyIndexes($flag)
  58. {
  59. $this->hasExplicitForeignKeyIndexes = (bool)$flag;
  60. }
  61. /**
  62. * @param integer $length
  63. *
  64. * @return void
  65. */
  66. public function setMaxIdentifierLength($length)
  67. {
  68. $this->maxIdentifierLength = (int)$length;
  69. }
  70. /**
  71. * @return integer
  72. */
  73. public function getMaxIdentifierLength()
  74. {
  75. return $this->maxIdentifierLength;
  76. }
  77. /**
  78. * Gets the default namespace of schema objects.
  79. *
  80. * @return string
  81. */
  82. public function getName()
  83. {
  84. return $this->name;
  85. }
  86. /**
  87. * Sets the default namespace name of schema objects.
  88. *
  89. * @param string $name The value to set.
  90. *
  91. * @return void
  92. */
  93. public function setName($name)
  94. {
  95. $this->name = $name;
  96. }
  97. /**
  98. * Gets the default options that are passed to Table instances created with
  99. * Schema#createTable().
  100. *
  101. * @return array
  102. */
  103. public function getDefaultTableOptions()
  104. {
  105. return $this->defaultTableOptions;
  106. }
  107. /**
  108. * @param array $defaultTableOptions
  109. *
  110. * @return void
  111. */
  112. public function setDefaultTableOptions(array $defaultTableOptions)
  113. {
  114. $this->defaultTableOptions = $defaultTableOptions;
  115. }
  116. }