Skip to content

Commit 9bcfdbb

Browse files
committed
Deprecate Sequence setters
1 parent 4d0224f commit 9bcfdbb

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

UPGRADE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ The `View` constructor has been marked as internal. Use `View::editor()` to inst
1818
1. The `Sequence` constructor has been marked as internal. Use `Sequence::editor()` to instantiate an editor and
1919
`SequenceEditor::create()` to create a sequence.
2020
2. Passing a negative value as sequence cache size has been deprecated.
21-
3. The `Sequence::getCache()` method has been deprecated. Use `Sequence::getCacheSize()` instead.
21+
22+
The following `Sequence` methods have been deprecated:
23+
24+
- `Sequence::getCache()` - use `Sequence::getCacheSize()` instead.
25+
- `Sequence::setAllocationSize()`, `Sequence::setInitialValue()` and `Sequence::setCache()` - use
26+
`SequenceEditor::setAllocationSize()`, `SequenceEditor::setInitialValue()` and `SequenceEditor::setCacheSize()`
27+
instead.
2228

2329
## Deprecated extension of schema classes
2430

src/Schema/Sequence.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,50 @@ public function getCacheSize(): ?int
8888
return $this->getCache();
8989
}
9090

91+
/** @deprecated Use {@see edit()} and {@see SequenceEditor::setAllocationSize()} instead. */
9192
public function setAllocationSize(int $allocationSize): self
9293
{
94+
Deprecation::triggerIfCalledFromOutside(
95+
'doctrine/dbal',
96+
'https://github.com/doctrine/dbal/pull/7115',
97+
'%s is deprecated. Use Sequence::edit() and SequenceEditor::setAllocationSize() instead.',
98+
__METHOD__,
99+
);
100+
93101
$this->allocationSize = $allocationSize;
94102

95103
return $this;
96104
}
97105

106+
/** @deprecated Use {@see edit()} and {@see SequenceEditor::setInitialValue()} instead. */
98107
public function setInitialValue(int $initialValue): self
99108
{
109+
Deprecation::triggerIfCalledFromOutside(
110+
'doctrine/dbal',
111+
'https://github.com/doctrine/dbal/pull/7115',
112+
'%s is deprecated. Use Sequence::edit() and SequenceEditor::setInitialValue() instead.',
113+
__METHOD__,
114+
);
115+
100116
$this->initialValue = $initialValue;
101117

102118
return $this;
103119
}
104120

105-
/** @param non-negative-int $cache */
121+
/**
122+
* @deprecated Use {@see edit()} and {@see SequenceEditor::setCacheSize()} instead.
123+
*
124+
* @param non-negative-int $cache
125+
*/
106126
public function setCache(int $cache): self
107127
{
128+
Deprecation::trigger(
129+
'doctrine/dbal',
130+
'https://github.com/doctrine/dbal/pull/7115',
131+
'%s is deprecated. Use Sequence::edit() and SequenceEditor::setCacheSize() instead.',
132+
__METHOD__,
133+
);
134+
108135
$this->cache = $cache;
109136

110137
return $this;

0 commit comments

Comments
 (0)