SchemaConfig.php 1.86 KB
Newer Older
1 2 3 4 5
<?php

namespace Doctrine\DBAL\Schema;

/**
Benjamin Morel's avatar
Benjamin Morel committed
6
 * Configuration for a Schema.
7 8 9
 */
class SchemaConfig
{
10
    /** @var bool */
11
    protected $hasExplicitForeignKeyIndexes = false;
12

13
    /** @var int */
14
    protected $maxIdentifierLength = 63;
15

16
    /** @var string */
17 18
    protected $name;

19
    /** @var mixed[] */
20
    protected $defaultTableOptions = [];
21

22
    /**
23
     * @return bool
24 25 26
     */
    public function hasExplicitForeignKeyIndexes()
    {
27
        return $this->hasExplicitForeignKeyIndexes;
28 29 30
    }

    /**
31
     * @param bool $flag
Benjamin Morel's avatar
Benjamin Morel committed
32 33
     *
     * @return void
34 35 36
     */
    public function setExplicitForeignKeyIndexes($flag)
    {
37
        $this->hasExplicitForeignKeyIndexes = (bool) $flag;
38 39 40
    }

    /**
41
     * @param int $length
Benjamin Morel's avatar
Benjamin Morel committed
42 43
     *
     * @return void
44 45 46
     */
    public function setMaxIdentifierLength($length)
    {
47
        $this->maxIdentifierLength = (int) $length;
48 49 50
    }

    /**
51
     * @return int
52 53 54
     */
    public function getMaxIdentifierLength()
    {
55
        return $this->maxIdentifierLength;
56
    }
57

58
    /**
Benjamin Morel's avatar
Benjamin Morel committed
59
     * Gets the default namespace of schema objects.
60 61 62 63
     *
     * @return string
     */
    public function getName()
64
    {
65
        return $this->name;
66 67
    }

68
    /**
Benjamin Morel's avatar
Benjamin Morel committed
69 70 71
     * Sets the default namespace name of schema objects.
     *
     * @param string $name The value to set.
72
     *
Benjamin Morel's avatar
Benjamin Morel committed
73
     * @return void
74 75
     */
    public function setName($name)
76
    {
77 78 79 80
        $this->name = $name;
    }

    /**
Benjamin Morel's avatar
Benjamin Morel committed
81
     * Gets the default options that are passed to Table instances created with
82 83
     * Schema#createTable().
     *
84
     * @return mixed[]
85 86 87 88 89 90
     */
    public function getDefaultTableOptions()
    {
        return $this->defaultTableOptions;
    }

Benjamin Morel's avatar
Benjamin Morel committed
91
    /**
92
     * @param mixed[] $defaultTableOptions
Benjamin Morel's avatar
Benjamin Morel committed
93 94 95
     *
     * @return void
     */
96 97 98
    public function setDefaultTableOptions(array $defaultTableOptions)
    {
        $this->defaultTableOptions = $defaultTableOptions;
99 100
    }
}