ModelGeneratorColumn.php 924 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace BotKit\Tools;
  3. // Колонка для генератора кода
  4. class ModelGeneratorColumn {
  5. private string $name;
  6. private bool $is_primary;
  7. private string $comment;
  8. private bool $is_nullable;
  9. public function __construct($name, $is_primary, $comment, $is_nullable) {
  10. $this->name = $name;
  11. $this->is_primary = $is_primary;
  12. $this->comment = $comment;
  13. $this->is_nullable = $is_nullable;
  14. }
  15. public function isPrimary() : bool {
  16. return $this->is_primary;
  17. }
  18. public function isNullable(): bool {
  19. return $this->is_nullable;
  20. }
  21. // Возвращает название колонки, но добавляет знак доллара перед ним
  22. public function getNameAsVariable() : string {
  23. return '$'.$this->name;
  24. }
  25. public function getName() : string {
  26. return $this->name;
  27. }
  28. public function getComment() : string {
  29. return $this->comment;
  30. }
  31. }