Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
scrs_zdenek committed Jan 31, 2024
1 parent 7c8a59d commit 9ad8a02
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 59 deletions.
25 changes: 0 additions & 25 deletions src/Drago/Generator/Attribute.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Drago/Generator/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function filename(string $name, string $suffix): string
*/
public function validateColumn(string $table, string $column): void
{
if (Strings::contains($column, '(')) {
if (str_contains($column, '(')) {
throw new ValidateColumnException('Wrong column name ' . $column . ' in table ' .
$table . ', change name or use AS');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Drago/Generator/Generator/DataClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function createPhpFile(string $table): void
->setPublic();

// Add to constant column length information.
if ($options->constantLengthDataClass) {
if ($options->constantSizeDataClass) {
if (!$attr->isAutoIncrement() && $attr->getSize() > 0) {
$class->addConstant($constant . 'Size', $attr->getSize())
->setPublic();
Expand Down
6 changes: 3 additions & 3 deletions src/Drago/Generator/Generator/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public function createPhpFile(string $table): void
->setPublic();
}

// Add to constant column length information
if ($options->constantLength) {
// Add to constant column size information
if ($options->constantSize) {
if (!$attr->isAutoIncrement() && $attr->getSize() > 0) {
$class->addConstant($constant . 'Size', $attr->getSize())
->setPublic();
Expand All @@ -123,7 +123,7 @@ public function createPhpFile(string $table): void
if ($attr->isAutoIncrement()) {
$create = $class->addProperty($column)
->setType($detectType)
->setNullable(true)
->setNullable()
->setPublic();

} else {
Expand Down
8 changes: 4 additions & 4 deletions src/Drago/Generator/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class Options
/** Add the name before the constant. */
public string|null $constantPrefix = null;

/** Allow constant column length. */
public bool $constantLength = false;
/** Allow constant column size. */
public bool $constantSize = false;

/** Allow table references in the property */
public bool $references = false;
Expand Down Expand Up @@ -72,8 +72,8 @@ class Options
/** Allow constant. */
public bool $constantDataClass = true;

/** Allow constant column length. */
public bool $constantLengthDataClass = true;
/** Allow constant column size. */
public bool $constantSizeDataClass = true;

/** Add the name before the constant. */
public string|null $constantDataPrefix = null;
Expand Down
25 changes: 0 additions & 25 deletions src/Drago/Generator/Type.php

This file was deleted.

0 comments on commit 9ad8a02

Please sign in to comment.