Skip to content

Commit

Permalink
Adopt last chages yiisoft/db. (#211)
Browse files Browse the repository at this point in the history
* Adopt last chages yiisoft/db.
  • Loading branch information
terabytesoftw committed Jan 5, 2023
1 parent aeab4dc commit 10c07d0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 43 deletions.
19 changes: 0 additions & 19 deletions src/ActiveQuery.php
Expand Up @@ -17,7 +17,6 @@
use Yiisoft\Db\Query\Helper\QueryHelper;
use Yiisoft\Db\Query\Query;
use Yiisoft\Db\Query\QueryInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilder;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Definitions\Exception\CircularReferenceException;
use Yiisoft\Definitions\Exception\NotInstantiableException;
Expand Down Expand Up @@ -136,24 +135,6 @@ public function all(): array
return parent::all();
}

/**
* Prepares for building SQL.
*
* This method is called by {@see QueryBuilder} when it starts to build SQL from a query object.
*
* You may override this method to do some final preparation work when converting a query into a SQL statement.
*
* @param QueryBuilderInterface $builder
*
* @throws Exception
* @throws InvalidArgumentException
* @throws InvalidConfigException
* @throws NotSupportedException
* @throws ReflectionException
* @throws Throwable
*
* @return QueryInterface a prepared query instance which will be used by {@see QueryBuilder} to build the SQL.
*/
public function prepare(QueryBuilderInterface $builder): QueryInterface
{
/**
Expand Down
22 changes: 0 additions & 22 deletions src/ActiveQueryInterface.php
Expand Up @@ -4,7 +4,6 @@

namespace Yiisoft\ActiveRecord;

use Closure;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Query\QueryInterface;

Expand All @@ -27,27 +26,6 @@ interface ActiveQueryInterface extends QueryInterface
*/
public function asArray(bool|null $value = true): self;

/**
* Sets the {@see indexBy} property.
*
* @param Closure|string|null $column the name of the column by which the query results should be indexed by.
*
* This can also be a callable (e.g. anonymous function) that returns the index value based on the given row or
* model data. The signature of the callable should be:
*
* ```php
* // $model is an AR instance when `asArray` is false,
* // or an array of column values when `asArray` is true.
* function ($model)
* {
* // return the index value corresponding to $model
* }
* ```
*
* @return QueryInterface the query object itself
*/
public function indexBy(string|Closure|null $column): QueryInterface;

/**
* Specifies the relations with which this query should be performed.
*
Expand Down
4 changes: 2 additions & 2 deletions tests/ActiveQueryTest.php
Expand Up @@ -20,7 +20,7 @@
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\OrderWithNullFK;
use Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord\Profile;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Db\Command\Command;
use Yiisoft\Db\Command\AbstractCommand;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidArgumentException;
use Yiisoft\Db\Exception\InvalidCallException;
Expand Down Expand Up @@ -85,7 +85,7 @@ public function testCreateCommand(): void
$this->checkFixture($this->db, 'customer');

$query = new ActiveQuery(Customer::class, $this->db);
$this->assertInstanceOf(Command::class, $query->createCommand());
$this->assertInstanceOf(AbstractCommand::class, $query->createCommand());
}

public function testQueryScalar(): void
Expand Down

0 comments on commit 10c07d0

Please sign in to comment.