DesignerTable.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Holds the PhpMyAdmin\Database\Designer\DesignerTable class
  5. *
  6. * @package PhpMyAdmin-Designer
  7. */
  8. namespace PhpMyAdmin\Database\Designer;
  9. use PhpMyAdmin\Util;
  10. /**
  11. * Common functions for Designer
  12. *
  13. * @package PhpMyAdmin-Designer
  14. */
  15. class DesignerTable
  16. {
  17. private $tableName;
  18. private $databaseName;
  19. private $tableEngine;
  20. private $displayField;
  21. /**
  22. * Create a new DesignerTable
  23. *
  24. * @param string $databaseName The database name
  25. * @param string $tableName The table name
  26. * @param string $tableEngine The table engine
  27. * @param string|null $displayField The display field if available
  28. */
  29. public function __construct(
  30. $databaseName,
  31. $tableName,
  32. $tableEngine,
  33. $displayField
  34. ) {
  35. $this->databaseName = $databaseName;
  36. $this->tableName = $tableName;
  37. $this->tableEngine = $tableEngine;
  38. $this->displayField = $displayField;
  39. }
  40. /**
  41. * The table engine supports or not foreign keys
  42. *
  43. * @return bool
  44. */
  45. public function supportsForeignkeys() {
  46. return Util::isForeignKeySupported($this->tableEngine);
  47. }
  48. /**
  49. * Get the database name
  50. *
  51. * @return string
  52. */
  53. public function getDatabaseName() {
  54. return $this->databaseName;
  55. }
  56. /**
  57. * Get the table name
  58. *
  59. * @return string
  60. */
  61. public function getTableName() {
  62. return $this->tableName;
  63. }
  64. /**
  65. * Get the table engine
  66. *
  67. * @return string
  68. */
  69. public function getTableEngine() {
  70. return $this->tableEngine;
  71. }
  72. /**
  73. * Get the displayed field
  74. *
  75. * @return string
  76. */
  77. public function getDisplayField()
  78. {
  79. return $this->displayField;
  80. }
  81. /**
  82. * Get the db and table separated with a dot
  83. *
  84. * @return string
  85. */
  86. public function getDbTableString() {
  87. return $this->databaseName . '.' . $this->tableName;
  88. }
  89. }