Identifier.php 666 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Doctrine\DBAL\Schema;
  3. /**
  4. * An abstraction class for an asset identifier.
  5. *
  6. * Wraps identifier names like column names in indexes / foreign keys
  7. * in an abstract class for proper quotation capabilities.
  8. */
  9. class Identifier extends AbstractAsset
  10. {
  11. /**
  12. * @param string $identifier Identifier name to wrap.
  13. * @param bool $quote Whether to force quoting the given identifier.
  14. */
  15. public function __construct($identifier, $quote = false)
  16. {
  17. $this->_setName($identifier);
  18. if (! $quote || $this->_quoted) {
  19. return;
  20. }
  21. $this->_setName('"' . $this->getName() . '"');
  22. }
  23. }