Skip to content

Commit

Permalink
Fix psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Jun 28, 2024
1 parent 0216f59 commit 20da8ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AbstractActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function insert(array $attributes = null): bool
*/
public function instantiateQuery(string|ActiveRecordInterface|Closure $arClass): ActiveQueryInterface
{
return new ActiveQuery($arClass, $this->db());
return new ActiveQuery($arClass);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ActiveQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ public function orOnCondition(array|string $condition, array $params = []): self
public function viaTable(string $tableName, array $link, callable $callable = null): self
{
$arClass = $this->primaryModel ?? $this->arClass;
$arClassInstance = new self($arClass, $this->db);
$arClassInstance = new self($arClass);

/** @psalm-suppress UndefinedMethod */
$relation = $arClassInstance->from([$tableName])->link($link)->multiple(true)->asArray();
Expand Down
6 changes: 6 additions & 0 deletions src/ActiveRecordInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Yiisoft\ActiveRecord;

use Throwable;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidArgumentException;
use Yiisoft\Db\Exception\InvalidConfigException;
Expand All @@ -24,6 +25,11 @@ interface ActiveRecordInterface
*/
public function attributes(): array;

/**
* Returns the database connection used by the Active Record instance.
*/
public function db(): ConnectionInterface;

/**
* Deletes the table row corresponding to this active record.
*
Expand Down

0 comments on commit 20da8ba

Please sign in to comment.