Identifier.php 666 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?php

namespace Doctrine\DBAL\Schema;

/**
 * An abstraction class for an asset identifier.
 *
 * Wraps identifier names like column names in indexes / foreign keys
 * in an abstract class for proper quotation capabilities.
 */
class Identifier extends AbstractAsset
{
    /**
     * @param string $identifier Identifier name to wrap.
15
     * @param bool   $quote      Whether to force quoting the given identifier.
16
     */
17
    public function __construct($identifier, $quote = false)
18 19
    {
        $this->_setName($identifier);
20

21 22
        if (! $quote || $this->_quoted) {
            return;
23
        }
24 25

        $this->_setName('"' . $this->getName() . '"');
26
    }
27
}