|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Doctrine\DBAL\Schema; |
| 4 | + |
| 5 | +use Doctrine\DBAL\Platforms\AbstractPlatform; |
| 6 | + |
| 7 | +/** |
| 8 | + * The abstract asset allows to reset the name of all assets without publishing this to the public userland. |
| 9 | + * |
| 10 | + * This encapsulation hack is necessary to keep a consistent state of the database schema. Say we have a list of tables |
| 11 | + * array($tableName => Table($tableName)); if you want to rename the table, you have to make sure this does not get |
| 12 | + * recreated during schema migration. |
| 13 | + */ |
| 14 | +abstract class AbstractAsset { |
| 15 | + /** @var string */ |
| 16 | + protected $_name = ''; |
| 17 | + |
| 18 | + /** |
| 19 | + * Namespace of the asset. If none isset the default namespace is assumed. |
| 20 | + * |
| 21 | + * @var string|null |
| 22 | + */ |
| 23 | + protected $_namespace; |
| 24 | + |
| 25 | + /** @var bool */ |
| 26 | + protected $_quoted = false; |
| 27 | + |
| 28 | + /** |
| 29 | + * Sets the name of this asset. |
| 30 | + * |
| 31 | + * @param string $name |
| 32 | + * |
| 33 | + * @return void |
| 34 | + */ |
| 35 | + protected function _setName($name) { |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Is this asset in the default namespace? |
| 40 | + * |
| 41 | + * @param string $defaultNamespaceName |
| 42 | + * |
| 43 | + * @return bool |
| 44 | + */ |
| 45 | + public function isInDefaultNamespace($defaultNamespaceName) { |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Gets the namespace name of this asset. |
| 50 | + * |
| 51 | + * If NULL is returned this means the default namespace is used. |
| 52 | + * |
| 53 | + * @return string|null |
| 54 | + */ |
| 55 | + public function getNamespaceName() { |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * The shortest name is stripped of the default namespace. All other |
| 60 | + * namespaced elements are returned as full-qualified names. |
| 61 | + * |
| 62 | + * @param string|null $defaultNamespaceName |
| 63 | + * |
| 64 | + * @return string |
| 65 | + */ |
| 66 | + public function getShortestName($defaultNamespaceName) { |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * The normalized name is full-qualified and lower-cased. Lower-casing is |
| 71 | + * actually wrong, but we have to do it to keep our sanity. If you are |
| 72 | + * using database objects that only differentiate in the casing (FOO vs |
| 73 | + * Foo) then you will NOT be able to use Doctrine Schema abstraction. |
| 74 | + * |
| 75 | + * Every non-namespaced element is prefixed with the default namespace |
| 76 | + * name which is passed as argument to this method. |
| 77 | + * |
| 78 | + * @deprecated Use {@see getNamespaceName()} and {@see getName()} instead. |
| 79 | + * |
| 80 | + * @param string $defaultNamespaceName |
| 81 | + * |
| 82 | + * @return string |
| 83 | + */ |
| 84 | + public function getFullQualifiedName($defaultNamespaceName) { |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * Checks if this asset's name is quoted. |
| 89 | + * |
| 90 | + * @return bool |
| 91 | + */ |
| 92 | + public function isQuoted() { |
| 93 | + } |
| 94 | + |
| 95 | + /** |
| 96 | + * Checks if this identifier is quoted. |
| 97 | + * |
| 98 | + * @param string $identifier |
| 99 | + * |
| 100 | + * @return bool |
| 101 | + */ |
| 102 | + protected function isIdentifierQuoted($identifier) { |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * Trim quotes from the identifier. |
| 107 | + * |
| 108 | + * @param string $identifier |
| 109 | + * |
| 110 | + * @return string |
| 111 | + */ |
| 112 | + protected function trimQuotes($identifier) { |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * Returns the name of this schema asset. |
| 117 | + * |
| 118 | + * @return string |
| 119 | + */ |
| 120 | + public function getName() { |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Gets the quoted representation of this asset but only if it was defined with one. Otherwise |
| 125 | + * return the plain unquoted value as inserted. |
| 126 | + * |
| 127 | + * @return string |
| 128 | + */ |
| 129 | + public function getQuotedName(AbstractPlatform $platform) { |
| 130 | + } |
| 131 | + |
| 132 | + /** |
| 133 | + * Generates an identifier from a list of column names obeying a certain string length. |
| 134 | + * |
| 135 | + * This is especially important for Oracle, since it does not allow identifiers larger than 30 chars, |
| 136 | + * however building idents automatically for foreign keys, composite keys or such can easily create |
| 137 | + * very long names. |
| 138 | + * |
| 139 | + * @param string[] $columnNames |
| 140 | + * @param string $prefix |
| 141 | + * @param int $maxSize |
| 142 | + * |
| 143 | + * @return string |
| 144 | + */ |
| 145 | + protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30) { |
| 146 | + } |
| 147 | +} |
0 commit comments