Skip to content

Commit

Permalink
Fix doctrine/dbal deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
bastien-phi committed Aug 11, 2022
1 parent 74cb45c commit 8e19e59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
8 changes: 0 additions & 8 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ parameters:
count: 1
path: src/Domain/Models/Actions/FindModels.php

-
message: """
#^Call to deprecated method getName\\(\\) of class Doctrine\\\\DBAL\\\\Types\\\\Type\\:
this method will be removed in Doctrine DBAL 4\\.0\\.$#
"""
count: 1
path: src/Domain/Models/Actions/ResolveModelAttributes.php

-
message: "#^PHPDoc tag @var contains generic class Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation but does not specify its types\\: TRelatedModel$#"
count: 1
Expand Down
3 changes: 2 additions & 1 deletion src/Domain/Models/Actions/ResolveModelAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Soyhuce\NextIdeHelper\Domain\Models\Actions;

use Doctrine\DBAL\Types\Type;
use Soyhuce\NextIdeHelper\Contracts\ModelResolver;
use Soyhuce\NextIdeHelper\Domain\Models\AttributeTypeCaster;
use Soyhuce\NextIdeHelper\Domain\Models\Entities\Attribute;
Expand All @@ -16,7 +17,7 @@ public function execute(Model $model): void
$typeCaster = new AttributeTypeCaster($model);

foreach ($columns as $column) {
$attribute = new Attribute($column->getName(), $column->getType()->getName());
$attribute = new Attribute($column->getName(), Type::getTypeRegistry()->lookupName($column->getType()));
$attribute->inDatabase = true;
if (!$column->getNotnull() && !$this->isLaravelTimestamp($model, $attribute)) {
$attribute->nullable = true;
Expand Down

0 comments on commit 8e19e59

Please sign in to comment.