SchemaConfig.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. *
  24. * @link www.doctrine-project.org
  25. * @since 2.0
  26. * @author Benjamin Eberlei <kontakt@beberlei.de>
  27. */
  28. class SchemaConfig
  29. {
  30. /**
  31. * @var bool
  32. */
  33. protected $hasExplicitForeignKeyIndexes = false;
  34. /**
  35. * @var int
  36. */
  37. protected $maxIdentifierLength = 63;
  38. /**
  39. * @var string
  40. */
  41. protected $name;
  42. /**
  43. * @var array
  44. */
  45. protected $defaultTableOptions = array();
  46. /**
  47. * @return bool
  48. */
  49. public function hasExplicitForeignKeyIndexes()
  50. {
  51. return $this->hasExplicitForeignKeyIndexes;
  52. }
  53. /**
  54. * @param bool $flag
  55. */
  56. public function setExplicitForeignKeyIndexes($flag)
  57. {
  58. $this->hasExplicitForeignKeyIndexes = (bool)$flag;
  59. }
  60. /**
  61. * @param int $length
  62. */
  63. public function setMaxIdentifierLength($length)
  64. {
  65. $this->maxIdentifierLength = (int)$length;
  66. }
  67. /**
  68. * @return int
  69. */
  70. public function getMaxIdentifierLength()
  71. {
  72. return $this->maxIdentifierLength;
  73. }
  74. /**
  75. * Get default namespace of schema objects.
  76. *
  77. * @return string
  78. */
  79. public function getName()
  80. {
  81. return $this->name;
  82. }
  83. /**
  84. * set default namespace name of schema objects.
  85. *
  86. * @param string $name the value to set.
  87. */
  88. public function setName($name)
  89. {
  90. $this->name = $name;
  91. }
  92. /**
  93. * Get the default options that are passed to Table instances created with
  94. * Schema#createTable().
  95. *
  96. * @return array
  97. */
  98. public function getDefaultTableOptions()
  99. {
  100. return $this->defaultTableOptions;
  101. }
  102. public function setDefaultTableOptions(array $defaultTableOptions)
  103. {
  104. $this->defaultTableOptions = $defaultTableOptions;
  105. }
  106. }