[345] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 6 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 7 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 8 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
| 9 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 10 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
| 11 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
| 12 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
| 13 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 14 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
| 15 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 16 | * |
---|
| 17 | * This software consists of voluntary contributions made by many individuals |
---|
| 18 | * and is licensed under the LGPL. For more information, see |
---|
| 19 | * <http://www.doctrine-project.org>. |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | namespace Doctrine\DBAL\Schema; |
---|
| 23 | |
---|
| 24 | use Doctrine\DBAL\Schema\Visitor\Visitor; |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * Sequence Structure |
---|
| 28 | * |
---|
| 29 | * @license http://www.opensource.org/licenses/lgpl-license.php LGPL |
---|
| 30 | * @link www.doctrine-project.org |
---|
| 31 | * @since 2.0 |
---|
| 32 | * @version $Revision$ |
---|
| 33 | * @author Benjamin Eberlei <kontakt@beberlei.de> |
---|
| 34 | */ |
---|
| 35 | class Sequence extends AbstractAsset |
---|
| 36 | { |
---|
| 37 | /** |
---|
| 38 | * @var int |
---|
| 39 | */ |
---|
| 40 | protected $_allocationSize = 1; |
---|
| 41 | |
---|
| 42 | /** |
---|
| 43 | * @var int |
---|
| 44 | */ |
---|
| 45 | protected $_initialValue = 1; |
---|
| 46 | |
---|
| 47 | /** |
---|
| 48 | * |
---|
| 49 | * @param string $name |
---|
| 50 | * @param int $allocationSize |
---|
| 51 | * @param int $initialValue |
---|
| 52 | */ |
---|
| 53 | public function __construct($name, $allocationSize=1, $initialValue=1) |
---|
| 54 | { |
---|
| 55 | $this->_setName($name); |
---|
| 56 | $this->_allocationSize = (is_numeric($allocationSize))?$allocationSize:1; |
---|
| 57 | $this->_initialValue = (is_numeric($initialValue))?$initialValue:1; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | public function getAllocationSize() |
---|
| 61 | { |
---|
| 62 | return $this->_allocationSize; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | public function getInitialValue() |
---|
| 66 | { |
---|
| 67 | return $this->_initialValue; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | public function setAllocationSize($allocationSize) |
---|
| 71 | { |
---|
| 72 | $this->_allocationSize = (is_numeric($allocationSize))?$allocationSize:1; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | public function setInitialValue($initialValue) |
---|
| 76 | { |
---|
| 77 | $this->_initialValue = (is_numeric($initialValue))?$initialValue:1; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | /** |
---|
| 81 | * @param Visitor $visitor |
---|
| 82 | */ |
---|
| 83 | public function visit(Visitor $visitor) |
---|
| 84 | { |
---|
| 85 | $visitor->acceptSequence($this); |
---|
| 86 | } |
---|
| 87 | } |
---|